# remote: Fix incorrect default repository selection when using remote \(\#41698\) · gitcafe/zed

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

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

Visibility: public

Requested revision: fc3e503cfe84813ce48b60869a59e920dfb486ec

Requested commit: fc3e503cfe84813ce48b60869a59e920dfb486ec

Commit: fc3e503cfe84813ce48b60869a59e920dfb486ec

Tree: 78f1efb245daad549ddd53c0c9f16c878b00da42

Author: ᴀᴍᴛᴏᴀᴇʀ

Committer: GitHub

## Message

```
remote: Fix incorrect default repository selection when using remote (#41698)

If I understand this correctly: The `active_repo_id` uses
`get_or_insert_with`, which makes it dependent on the `RepositoryAdded`
event sequence. To ensure correct initialization of the `active_repo_id`
on the remote side, the first local `RepositoryAdded` event must
synchronously send an `UpdateRepository` to `updates_tx`.

Closes #30694

Release Notes:

- Fixed incorrect default repository selection when using remote
```

## Parents

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

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