# workspace: Fix closing remote workspace restores last local workspace on startup \(\#34931\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/11ac83f3d46b2f979a3a13918ea9912f73d21501)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 11ac83f3d46b2f979a3a13918ea9912f73d21501

Requested commit: 11ac83f3d46b2f979a3a13918ea9912f73d21501

Commit: 11ac83f3d46b2f979a3a13918ea9912f73d21501

Tree: 4249a0e842661f226b55a21760cc252e5e6f921b

Author: Smit Barmase

Committer: GitHub

## Message

```
workspace: Fix closing remote workspace restores last local workspace on startup (#34931)

Closes #7759

While opening a new SSH project if we are reusing an existing window,
i.e. drop the existing workspace and create a new one, then before
dropping it, we should remove `session_id` from that workspace's
serialized entry. That way:

1. Upon closing (cmd-w) this remote workspace (which also clears
`session_id` for this), and then quitting. No workspace with that
`session_id` is found, and it starts fresh.
2. Upon directly quitting (cmd-q) this remote workspace, only this
workspace exists in db (among two of them) with that `session_id`, and
it restores correctly.
 
Release Notes:

- Fixed an issue while closing remote workspace restores last local
workspace on startup.
```

## Parents

- [e90cf0b9412b7f8fcb557d1edb2c3f586c7bd45b](https://git.cafe/gitcafe/zed/commit/e90cf0b9412b7f8fcb557d1edb2c3f586c7bd45b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/11ac83f3d46b2f979a3a13918ea9912f73d21501?format=markdown)
