Skip to content

Commit 1242bdf

Browse files
twaughclaude
andcommitted
Increase search debounce to 500ms and add Enter to search
Reduce unnecessary API calls while typing by increasing the debounce delay. Allow pressing Enter to trigger an immediate search when no result is selected. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 11174b0 commit 1242bdf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/ui.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function createSearchModal(): void {
5454
const debouncedSearch = debounce(async (...args: unknown[]) => {
5555
const query = args[0] as string;
5656
await performSearch(query);
57-
}, 300);
57+
}, 500);
5858

5959
input.addEventListener("input", () => {
6060
historyIndex = -1;
@@ -167,6 +167,10 @@ function handleKeydown(e: KeyboardEvent): void {
167167
(active as HTMLElement).dispatchEvent(
168168
new MouseEvent("click", { shiftKey: e.shiftKey, bubbles: true }),
169169
);
170+
} else if (e.key === "Enter" && !active && input && document.activeElement === input) {
171+
e.preventDefault();
172+
const query = input.value.trim();
173+
if (query) performSearch(query);
170174
} else if (e.key === "c" && (e.ctrlKey || e.metaKey) && active) {
171175
e.preventDefault();
172176
const blockId = active.getAttribute("data-block-id");

0 commit comments

Comments
 (0)