From fc4e1bbf6b0fa2ec37445a5b72356514c7c6be6a Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sat, 30 May 2026 23:58:15 +0300 Subject: perf: reduce sidebar git polling overhead refs #353 --- src/app/api.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/app/api.rs') diff --git a/src/app/api.rs b/src/app/api.rs index a26b2856..d8224506 100644 --- a/src/app/api.rs +++ b/src/app/api.rs @@ -21,14 +21,29 @@ enum RuntimeExitAction { impl App { pub(crate) fn handle_internal_event(&mut self, ev: AppEvent) { if let AppEvent::ClipboardWrite { content } = ev { + #[cfg(not(test))] crate::selection::write_osc52_bytes(&content); + #[cfg(test)] + let _ = content; self.show_clipboard_feedback(); return; } - if let AppEvent::GitStatusRefreshed { results } = ev { + if let AppEvent::GitStatusRefreshed { + results, + cache_updates, + } = ev + { self.git_refresh_in_flight = false; - self.last_git_remote_status_refresh = Instant::now(); + for (key, entry) in cache_updates { + self.git_status_cache.insert(key, entry); + } + if self.git_refresh_due_after_in_flight { + self.mark_git_status_refresh_due(Instant::now()); + self.git_refresh_due_after_in_flight = false; + } else { + self.last_git_remote_status_refresh = Instant::now(); + } if self .state .apply_workspace_git_statuses(&self.terminal_runtimes, results) -- cgit v1.2.3