From 28ba0250bacce07eb7483da95932dca9fe3458bc Mon Sep 17 00:00:00 2001 From: busya Date: Wed, 17 Jun 2026 17:33:44 +0300 Subject: [PATCH] fix: unhandled promise rejection in SearchableMultiSelect debounce - Wrap onSearch call in .catch() to prevent Uncaught (in promise) errors - Add console.warn to DashboardHubModel.loadDashboardSearchOptions catch for debugging visibility --- frontend/src/lib/components/ui/SearchableMultiSelect.svelte | 5 ++++- frontend/src/lib/models/DashboardHubModel.svelte.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/components/ui/SearchableMultiSelect.svelte b/frontend/src/lib/components/ui/SearchableMultiSelect.svelte index 77b09b6f..95ce5f59 100644 --- a/frontend/src/lib/components/ui/SearchableMultiSelect.svelte +++ b/frontend/src/lib/components/ui/SearchableMultiSelect.svelte @@ -62,7 +62,10 @@ searchQuery = e.target.value; if (debounceMs > 0 && onSearch) { clearTimeout(debounceTimer); - debounceTimer = setTimeout(() => onSearch(searchQuery), debounceMs); + debounceTimer = setTimeout(() => { + const result = onSearch(searchQuery); + if (result instanceof Promise) result.catch(() => {}); + }, debounceMs); } if (!isOpen) isOpen = true; } diff --git a/frontend/src/lib/models/DashboardHubModel.svelte.ts b/frontend/src/lib/models/DashboardHubModel.svelte.ts index af8f84ea..4ead8847 100644 --- a/frontend/src/lib/models/DashboardHubModel.svelte.ts +++ b/frontend/src/lib/models/DashboardHubModel.svelte.ts @@ -391,7 +391,10 @@ export class DashboardHubModel { id: d.id, name: d.title, subtitle: d.slug || '', hint: d.last_modified ? formatDate(d.last_modified) : '', })); - } catch { this.searchableDashboardOptions = []; } + } catch { + this.searchableDashboardOptions = []; + console.warn('[DashboardHub] loadDashboardSearchOptions failed'); + } finally { this.searchableDashboardLoading = false; } }