diff --git a/src/lib/components/FormattingToolbar.svelte b/src/lib/components/FormattingToolbar.svelte index 24b1474..60a2bcf 100644 --- a/src/lib/components/FormattingToolbar.svelte +++ b/src/lib/components/FormattingToolbar.svelte @@ -62,11 +62,15 @@ noteSearchResults = []; return; } - const res = await fetch(`/api/search?q=${encodeURIComponent(query)}`); - if (requestId !== noteSearchRequestId) return; - if (!res.ok) return; - const results: { id: string; title: string }[] = await res.json(); - noteSearchResults = results.filter((n) => n.id !== currentNoteId); + try { + const res = await fetch(`/api/search?q=${encodeURIComponent(query)}`); + if (requestId !== noteSearchRequestId) return; + if (!res.ok) return; + const results: { id: string; title: string }[] = await res.json(); + noteSearchResults = results.filter((n) => n.id !== currentNoteId); + } catch { + // Search failed silently + } } let noteSearchRequestId = 0; @@ -115,6 +119,7 @@ function closeDropdowns() { openDropdown = null; dropdownAnchorEl = null; + clearTimeout(noteSearchTimer); noteSearchResults = []; } diff --git a/src/lib/components/NoteEditor.svelte b/src/lib/components/NoteEditor.svelte index 3573a86..404e79e 100644 --- a/src/lib/components/NoteEditor.svelte +++ b/src/lib/components/NoteEditor.svelte @@ -3,7 +3,7 @@