Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: add 60s timeout to scan button to prevent stuck UI

Louis Beaumontb6c652c47663
diff --git a/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx b/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx
index 5589fc51f..2b1ee489d 100644
--- a/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx
@@ -187,7 +187,7 @@ export function AppleIntelligenceCard() {
setIsScanning(true);
setLastScanResult(null);
try {
- const result = await invoke<{
+ const scanPromise = invoke<{
remindersCreated: number;
items: { title: string }[];
contextChars: number;
@@ -196,6 +196,12 @@ export function AppleIntelligenceCard() {
customPrompt: customPrompt || null,
});
+ const timeoutPromise = new Promise<never>((_, reject) =>
+ setTimeout(() => reject(new Error("scan timed out after 60s")), 60000)
+ );
+
+ const result = await Promise.race([scanPromise, timeoutPromise]);
+
if (result.error) {
setLastScanResult(result.error);
} else if (result.remindersCreated > 0) {