feat: brain live search — results appear as you type (300ms debounce)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -208,8 +208,13 @@
|
||||
if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); capture(); }
|
||||
}
|
||||
|
||||
function handleSearchKey(e: KeyboardEvent) {
|
||||
if (e.key === 'Enter') search();
|
||||
let searchTimer: ReturnType<typeof setTimeout>;
|
||||
|
||||
function handleSearchInput() {
|
||||
clearTimeout(searchTimer);
|
||||
searchTimer = setTimeout(() => {
|
||||
search();
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// Poll for pending items
|
||||
@@ -345,7 +350,7 @@
|
||||
class="search-input"
|
||||
placeholder="Search your brain..."
|
||||
bind:value={searchQuery}
|
||||
onkeydown={handleSearchKey}
|
||||
oninput={handleSearchInput}
|
||||
/>
|
||||
{#if searchQuery}
|
||||
<button class="search-clear" onclick={() => { searchQuery = ''; loadItems(); }}>
|
||||
|
||||
Reference in New Issue
Block a user