Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(desktop-gpui): defer the library refresh until the delete window update ends

Aditya Garud052fab6bfb52
diff --git a/apps/desktop-gpui/src/app_windows.rs b/apps/desktop-gpui/src/app_windows.rs
index 830cdc22b..59c694e68 100644
--- a/apps/desktop-gpui/src/app_windows.rs
+++ b/apps/desktop-gpui/src/app_windows.rs
@@ -549,7 +549,6 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, c
cx.spawn(async move |cx| {
while thumbnails.recv_async().await.is_ok() {
cx.update(|cx| {
- crate::tray::refresh_previous(cx);
refresh_library_after_delete(cx);
crate::menus::recheck_pending_quit(cx);
});
diff --git a/apps/desktop-gpui/src/import.rs b/apps/desktop-gpui/src/import.rs
index 58b8a4438..165d7244d 100644
--- a/apps/desktop-gpui/src/import.rs
+++ b/apps/desktop-gpui/src/import.rs
@@ -257,9 +257,9 @@ fn apply_progress(update: ImportProgress, cx: &mut App) {
repaint_main_window(cx);
}
-/// The refresh seam a finished import rides: the Recents carousel and the
-/// settings Recordings page (`refresh_library_after_delete`), the open library
-/// panel, and the tray's Previous submenu.
+/// The refresh seam a finished import rides: the Recents carousel, the
+/// settings Recordings page and the tray's Previous submenu
+/// (`refresh_library_after_delete`), and the open library panel.
fn refresh_libraries(cx: &mut App) {
if !cx.has_global::<crate::app_windows::AppWindows>() {
return;
@@ -268,7 +268,6 @@ fn refresh_libraries(cx: &mut App) {
let main = cx.global::<crate::app_windows::AppWindows>().main;
main.update(cx, |view, window, cx| view.refresh_open_library(window, cx))
.ok();
- crate::tray::refresh_previous(cx);
}
/// The main window is rarely the active window while an import ticks, and an
diff --git a/apps/desktop-gpui/src/main_window.rs b/apps/desktop-gpui/src/main_window.rs
index bc12bbba9..49e146031 100644
--- a/apps/desktop-gpui/src/main_window.rs
+++ b/apps/desktop-gpui/src/main_window.rs
@@ -4969,7 +4969,7 @@ impl MainWindow {
tracing::error!(path = %path.display(), "deleting the recording failed: {error}");
return;
}
- cx.update(|_, cx| app_windows::refresh_library_after_delete(cx))
+ cx.update(|_, cx| cx.defer(app_windows::refresh_library_after_delete))
.ok();
})
.detach();
diff --git a/apps/desktop-gpui/src/settings_window.rs b/apps/desktop-gpui/src/settings_window.rs
index e57635008..10e2a3035 100644
--- a/apps/desktop-gpui/src/settings_window.rs
+++ b/apps/desktop-gpui/src/settings_window.rs
@@ -1214,7 +1214,7 @@ impl SettingsWindow {
}
tracing::info!(path = %path.display(), "deleted a recording");
- cx.update(|_, cx| crate::app_windows::refresh_library_after_delete(cx))
+ cx.update(|_, cx| cx.defer(crate::app_windows::refresh_library_after_delete))
.ok();
})
.detach();