From f062aad2b49a85def3309fe097267bf45ec5f245 Mon Sep 17 00:00:00 2001 From: Xylight Date: Sat, 20 Jul 2024 14:02:28 -0700 Subject: [PATCH] fix: search on enter --- src/lib/components/ui/navbar/commands/Commands.svelte | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/components/ui/navbar/commands/Commands.svelte b/src/lib/components/ui/navbar/commands/Commands.svelte index ef238d06..c9a233f5 100644 --- a/src/lib/components/ui/navbar/commands/Commands.svelte +++ b/src/lib/components/ui/navbar/commands/Commands.svelte @@ -64,7 +64,7 @@ } } - const debouncedSearch = debounce((term: string) => { + function searchGroup(term: string) { if (term.length < 1) { if (breadcrumbs.length <= 0) { filteredGroups = groups.map((group) => ({ @@ -98,7 +98,9 @@ .filter((group) => group.actions.length > 0) .sort((a, b) => b.score - a.score) } - }, 50) + } + + const debouncedSearch = debounce((term: string) => searchGroup(term), 50) function updateFilteredGroups() { if (breadcrumbs.length === 0) { @@ -177,6 +179,7 @@ focusItem(selectedIndex) break case 'Enter': + searchGroup(search) handleSelect(flattenedActions[selectedIndex]) break case 'Escape':