Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(desktop-gpui): retry thumbnail sweeps a capture hang cut short

Aatman Jain (AJ)7d12f22694d2
diff --git a/apps/desktop-gpui/src/main_window.rs b/apps/desktop-gpui/src/main_window.rs
index ffb88c96e..c8c508bcd 100644
--- a/apps/desktop-gpui/src/main_window.rs
+++ b/apps/desktop-gpui/src/main_window.rs
@@ -1269,9 +1269,13 @@ impl MainWindow {
// `setDisplayThumbnailsSignature` runs
// (`new-main/index.tsx:2617-2620`). Committing the
// signature at `Listed` time instead would mark a sweep
- // that never landed as up to date.
+ // that never landed as up to date. Likewise a sweep that a
+ // capture hang cut short: it stays stale so the picker
+ // retries it once the pause lifts.
this.update(cx, |this, cx| {
- if let Some(signature) = swept {
+ if let Some(signature) = swept
+ && !target_thumbnails::captures_paused()
+ {
this.thumbnails.set_display_signature(signature);
}
this.thumbnails.set_display_inflight(false);
@@ -1316,7 +1320,9 @@ impl MainWindow {
}
}
this.update(cx, |this, cx| {
- if let Some(signature) = swept {
+ if let Some(signature) = swept
+ && !target_thumbnails::captures_paused()
+ {
this.thumbnails.set_window_signature(signature);
}
this.thumbnails.set_window_inflight(false);
diff --git a/apps/desktop-gpui/src/target_thumbnails.rs b/apps/desktop-gpui/src/target_thumbnails.rs
index f94ed2b3e..16a779239 100644
--- a/apps/desktop-gpui/src/target_thumbnails.rs
+++ b/apps/desktop-gpui/src/target_thumbnails.rs
@@ -1571,7 +1571,7 @@ mod tests {
assert!(!pause.active_at(now));
pause.start_at(now);
assert!(pause.active_at(now));
- assert!(pause.active_at(now + CAPTURE_HANG_PAUSE - Duration::from_millis(1)));
+ assert!(pause.active_at(now + CAPTURE_HANG_PAUSE.saturating_sub(Duration::from_millis(1))));
assert!(!pause.active_at(now + CAPTURE_HANG_PAUSE));
}
}