From 1cd2f69794a894493670556f0b29560fa54c3891 Mon Sep 17 00:00:00 2001 From: "Jasmeet (Jazz) Bhatia" Date: Sun, 11 Oct 2026 18:43:44 -0700 Subject: [PATCH 1/2] perf(gui): coalesce diff refresh after staging --- src/gui/controller/files.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/controller/files.rs b/src/gui/controller/files.rs index e88ae89c..261f446c 100644 --- a/src/gui/controller/files.rs +++ b/src/gui/controller/files.rs @@ -161,7 +161,6 @@ fn toggle_stage(gui: &mut Gui) -> Result<()> { } drop(model); gui.rebuild_file_tree_from_model(); - gui.needs_diff_refresh = true; if !to_stage.is_empty() { gui.enqueue_stage_then_refresh(to_stage, true); @@ -194,7 +193,6 @@ fn toggle_stage(gui: &mut Gui) -> Result<()> { } drop(model); gui.rebuild_file_tree_from_model(); - gui.needs_diff_refresh = true; if should_stage { gui.enqueue_stage_then_refresh(vec![add_path], true); @@ -226,7 +224,6 @@ fn toggle_stage_all(gui: &mut Gui) -> Result<()> { } drop(model); gui.rebuild_file_tree_from_model(); - gui.needs_diff_refresh = true; gui.enqueue_stage_all_then_refresh(stage); Ok(()) } From 9d630e1edbb6ec71e1df24d11a20eff13a22e71c Mon Sep 17 00:00:00 2001 From: Blankeos Date: Thu, 5 Nov 2026 16:44:35 +0800 Subject: [PATCH 2/2] fix(gui): reload the diff when the status refresh fails after staging --- src/gui/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/mod.rs b/src/gui/mod.rs index cf297b91..f5b47ca6 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -2809,12 +2809,16 @@ impl Gui { Ok(Err(err)) => { self.files_refresh_rx = None; self.files_refresh_in_progress = false; + // The eager diff refresh was dropped from the stage handlers, so reload + // the diff from real git state even though the status refresh failed. + self.needs_diff_refresh = true; self.show_error("Refresh failed", err); } Err(mpsc::TryRecvError::Empty) => {} Err(mpsc::TryRecvError::Disconnected) => { self.files_refresh_rx = None; self.files_refresh_in_progress = false; + self.needs_diff_refresh = true; } } } @@ -9711,6 +9715,10 @@ mod terminal_mouse_tests { gui.receive_files_refresh(); assert!(!gui.files_refresh_in_progress); assert!(gui.files_refresh_rx.is_none()); + assert!( + gui.needs_diff_refresh, + "a failed status refresh must still reload the diff" + ); // Repeated auto-refresh failures are coalesced while the shell is open. gui.show_error("Refresh failed", anyhow::anyhow!("refresh fixture failure")); assert_eq!(gui.deferred_notifications.len(), 1);