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
This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2025-11-04 11:15:35 -05:00
committed by GitHub
parent 52c49b86b2
commit fc3e503cfe
+6
View File
@@ -1268,6 +1268,12 @@ impl GitStore {
git_store,
cx,
);
if let Some(updates_tx) = updates_tx.as_ref() {
// trigger an empty `UpdateRepository` to ensure remote active_repo_id is set correctly
updates_tx
.unbounded_send(DownstreamUpdate::UpdateRepository(repo.snapshot()))
.ok();
}
repo.schedule_scan(updates_tx.clone(), cx);
repo
});