From af601e9ae7c62d503a740fc71348027792deddf8 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 15:33:28 +0000 Subject: [PATCH] git_graph: Fix loading graph hang (#52875) (cherry-pick to preview) (#52999) Cherry-pick of #52875 to preview ---- This hang was caused by emitting the Git Graph Count Updated event for every commit being added to the graph instead of every batch of commits. This would cause gpui to have a massive amount of events to handle on the foreground thread, even if most of them had very little work involved. For example, Zed graph has over 80k commits, that means we were emitting 80k plus events instead of 80. - [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 Closes #ISSUE Release Notes: - N/A or Added/Fixed/Improved ... Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> --- crates/project/src/git_store.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs index 36479fb80f561665e01853eba5a214eb84088361..fc1458979c06fd32aea95056d09703e01ebce897 100644 --- a/crates/project/src/git_store.rs +++ b/crates/project/src/git_store.rs @@ -4705,12 +4705,11 @@ impl Repository { .commit_oid_to_index .insert(commit_data.sha, graph_data.commit_data.len()); graph_data.commit_data.push(commit_data); - - cx.emit(RepositoryEvent::GraphEvent( - graph_data_key.clone(), - GitGraphEvent::CountUpdated(graph_data.commit_data.len()), - )); } + cx.emit(RepositoryEvent::GraphEvent( + graph_data_key.clone(), + GitGraphEvent::CountUpdated(graph_data.commit_data.len()), + )); }); match &graph_data {