# workspace: Activate the right tab when restoring a workspace \(\#62844\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 4c7244790a075e862eeb4e5ccc12d6c8f5da6f7e

Requested commit: 4c7244790a075e862eeb4e5ccc12d6c8f5da6f7e

Commit: 4c7244790a075e862eeb4e5ccc12d6c8f5da6f7e

Tree: 56aeb317b1ea9e0da84eb31000dc55331e8e7447

Author: Arnesh

Committer: GitHub

## Message

```
workspace: Activate the right tab when restoring a workspace (#62844)

@SomeoneToIgnore this is the follow up you asked for in #62692, done as
discussed.

`deserialize_to` keeps a `None` in `items` for every item that failed to
deserialize, and those are never added to the pane. Any later tab
therefore sits at a lower index in the pane than the one it was
serialized with, so activating and previewing by serialized index lands
on the tab that shifted into that slot. When the failing item is the
last one, the index points past the end of the pane and nothing is
activated or previewed.

The serialized index is now mapped to the pane's index by counting the
items before it that actually restored, and an index whose own item
failed to restore is skipped.

Closes #62843

Release Notes:

- Fixed the wrong tab being activated when restoring a workspace
containing items that fail to open

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
```

## Parents

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

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