# sidebar: Make sure workspace has git state loaded when opening a new one \(\#52233\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 9b0f454995374eee71d7729a42475610085b5827

Requested commit: 9b0f454995374eee71d7729a42475610085b5827

Commit: 9b0f454995374eee71d7729a42475610085b5827

Tree: 7b21aa6a885fca842ee35d50e5dde486c8fcc88b

Author: Anthony Eid

Committer: GitHub

## Message

```
sidebar: Make sure workspace has git state loaded when opening a new one (#52233)

## Context

This fixes a bug where switching to a worktree workspace sometimes
briefly flashes it as a top-level project in the sidebar. This happened
because the sidebar would rebuild its entries whenever the multi
workspace emits the added workspace event.

The fix is checking from the root workspace git linked worktree list as
well to see if newly added workspaces are linked.

## Self-Review Checklist

<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
```

## Parents

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

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