This commit is contained in:
Timothy Jaeryang Baek
2026-06-17 00:17:14 +02:00
parent 6f2e97aa58
commit fc9c2ea191
13 changed files with 81 additions and 51 deletions
+4 -2
View File
@@ -71,12 +71,12 @@
let functions = null; let functions = null;
let filteredItems = []; let filteredItems = [];
$: if (query !== undefined) { const handleSearchInput = () => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
setFilteredItems(); setFilteredItems();
}, 300); }, 300);
} };
$: if (functions && selectedType !== undefined && viewOption !== undefined) { $: if (functions && selectedType !== undefined && viewOption !== undefined) {
setFilteredItems(); setFilteredItems();
@@ -363,6 +363,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
placeholder={$i18n.t('Search Functions')} placeholder={$i18n.t('Search Functions')}
/> />
@@ -372,6 +373,7 @@
class="p-0.5 rounded-full hover:bg-gray-100 dark:hover:bg-gray-900 transition" class="p-0.5 rounded-full hover:bg-gray-100 dark:hover:bg-gray-900 transition"
on:click={() => { on:click={() => {
query = ''; query = '';
handleSearchInput();
}} }}
> >
<XMark className="size-3" strokeWidth="2" /> <XMark className="size-3" strokeWidth="2" />
@@ -84,13 +84,16 @@
getUserList(); getUserList();
} }
$: if (query !== undefined) { const handleSearchInput = () => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
page = 1; if (page !== 1) {
getUserList(); page = 1;
} else {
getUserList();
}
}, 300); }, 300);
} };
onDestroy(() => { onDestroy(() => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
@@ -106,6 +109,7 @@
<input <input
class=" w-full text-sm pr-4 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
placeholder={$i18n.t('Search')} placeholder={$i18n.t('Search')}
/> />
</div> </div>
@@ -100,13 +100,16 @@
} }
}; };
$: if (query !== undefined) { const handleSearchInput = () => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
page = 1; if (page !== 1) {
getUserList(); page = 1;
} else {
getUserList();
}
}, 300); }, 300);
} };
$: if (page !== null && orderBy !== null && direction !== null) { $: if (page !== null && orderBy !== null && direction !== null) {
getUserList(); getUserList();
@@ -210,6 +213,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
aria-label={$i18n.t('Search')} aria-label={$i18n.t('Search')}
placeholder={$i18n.t('Search')} placeholder={$i18n.t('Search')}
/> />
@@ -78,13 +78,14 @@
} }
}; };
// Debounce only query changes const handleSearchInput = () => {
$: if (query !== undefined && channel !== null) { if (channel === null) return;
clearTimeout(debounceTimer); clearTimeout(debounceTimer);
debounceTimer = setTimeout(() => { debounceTimer = setTimeout(() => {
getUserList(); getUserList();
}, 300); }, 300);
} };
// Immediate response to page/sort changes // Immediate response to page/sort changes
$: if (channel !== null && page && orderBy && direction) { $: if (channel !== null && page && orderBy && direction) {
@@ -142,6 +143,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
placeholder={$i18n.t('Search')} placeholder={$i18n.t('Search')}
/> />
</div> </div>
+4 -2
View File
@@ -180,14 +180,14 @@
await getItemsPage(); await getItemsPage();
}; };
$: if (query !== undefined) { const handleSearchInput = () => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
if (loaded) { if (loaded) {
init(); init();
} }
}, 300); }, 300);
} };
$: if (loaded && sortKey !== undefined && permission !== undefined && viewOption !== undefined) { $: if (loaded && sortKey !== undefined && permission !== undefined && viewOption !== undefined) {
init(); init();
@@ -380,6 +380,7 @@
<input <input
class=" w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
placeholder={$i18n.t('Search Notes')} placeholder={$i18n.t('Search Notes')}
/> />
@@ -389,6 +390,7 @@
class="p-0.5 rounded-full hover:bg-gray-100 dark:hover:bg-gray-900 transition" class="p-0.5 rounded-full hover:bg-gray-100 dark:hover:bg-gray-900 transition"
on:click={() => { on:click={() => {
query = ''; query = '';
handleSearchInput();
}} }}
> >
<XMark className="size-3" strokeWidth="2" /> <XMark className="size-3" strokeWidth="2" />
@@ -45,12 +45,12 @@
let allItemsLoaded = false; let allItemsLoaded = false;
let itemsLoading = false; let itemsLoading = false;
$: if (query !== undefined) { const handleSearchInput = () => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
init(); init();
}, 300); }, 300);
} };
onDestroy(() => { onDestroy(() => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
@@ -199,6 +199,7 @@
<input <input
class=" w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
aria-label={$i18n.t('Search Knowledge')} aria-label={$i18n.t('Search Knowledge')}
placeholder={$i18n.t('Search Knowledge')} placeholder={$i18n.t('Search Knowledge')}
/> />
@@ -209,6 +210,7 @@
aria-label={$i18n.t('Clear search')} aria-label={$i18n.t('Clear search')}
on:click={() => { on:click={() => {
query = ''; query = '';
handleSearchInput();
}} }}
> >
<XMark className="size-3" strokeWidth="2" /> <XMark className="size-3" strokeWidth="2" />
@@ -142,14 +142,17 @@
await getItemsPage(); await getItemsPage();
}; };
// Debounce only query changes const handleSearchInput = () => {
$: if (query !== undefined) {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
getItemsPage(); if (currentPage !== 1) {
currentPage = 1;
} else {
getItemsPage();
}
}, 300); }, 300);
} };
// Immediate response to filter/pagination changes // Immediate response to filter/pagination changes
$: if ( $: if (
@@ -163,15 +166,6 @@
getItemsPage(); getItemsPage();
} }
$: if (
query !== undefined &&
viewOption !== undefined &&
sortKey !== undefined &&
direction !== undefined
) {
reset();
}
const getItemsPage = async () => { const getItemsPage = async () => {
if (knowledgeId === null) return; if (knowledgeId === null) return;
@@ -1313,6 +1307,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
aria-label={$i18n.t('Search Collection')} aria-label={$i18n.t('Search Collection')}
placeholder={$i18n.t('Search Collection')} placeholder={$i18n.t('Search Collection')}
on:focus={() => { on:focus={() => {
@@ -34,12 +34,12 @@
$: items = [...noteItems, ...knowledgeItems, ...fileItems]; $: items = [...noteItems, ...knowledgeItems, ...fileItems];
$: if (query !== undefined) { const handleSearchInput = () => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
getItems(); getItems();
}, 300); }, 300);
} };
onDestroy(() => { onDestroy(() => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
@@ -111,6 +111,7 @@
if (e.detail === false) { if (e.detail === false) {
onClose(); onClose();
query = ''; query = '';
handleSearchInput();
} }
}} }}
> >
@@ -128,6 +129,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
placeholder={$i18n.t('Search')} placeholder={$i18n.t('Search')}
/> />
</div> </div>
+9 -5
View File
@@ -59,15 +59,17 @@
let page = 1; let page = 1;
// Debounce only query changes const handleSearchInput = () => {
$: if (query !== undefined) {
loading = true; loading = true;
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
page = 1; if (page !== 1) {
getPromptList(); page = 1;
} else {
getPromptList();
}
}, 300); }, 300);
} };
// Immediate response to page/filter changes // Immediate response to page/filter changes
$: if (page && selectedTag !== undefined && viewOption !== undefined) { $: if (page && selectedTag !== undefined && viewOption !== undefined) {
@@ -332,6 +334,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
aria-label={$i18n.t('Search Prompts')} aria-label={$i18n.t('Search Prompts')}
placeholder={$i18n.t('Search Prompts')} placeholder={$i18n.t('Search Prompts')}
/> />
@@ -343,6 +346,7 @@
aria-label={$i18n.t('Clear search')} aria-label={$i18n.t('Clear search')}
on:click={() => { on:click={() => {
query = ''; query = '';
handleSearchInput();
}} }}
> >
<XMark className="size-3" strokeWidth="2" /> <XMark className="size-3" strokeWidth="2" />
+9 -5
View File
@@ -78,15 +78,17 @@
} }
}; };
// Debounce only query changes const handleSearchInput = () => {
$: if (query !== undefined) {
loading = true; loading = true;
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
page = 1; if (page !== 1) {
loadSkillItems(); page = 1;
} else {
loadSkillItems();
}
}, 300); }, 300);
} };
// Immediate response to page/filter changes // Immediate response to page/filter changes
$: if (page && viewOption !== undefined) { $: if (page && viewOption !== undefined) {
@@ -321,6 +323,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
aria-label={$i18n.t('Search Skills')} aria-label={$i18n.t('Search Skills')}
placeholder={$i18n.t('Search Skills')} placeholder={$i18n.t('Search Skills')}
/> />
@@ -331,6 +334,7 @@
aria-label={$i18n.t('Clear search')} aria-label={$i18n.t('Clear search')}
on:click={() => { on:click={() => {
query = ''; query = '';
handleSearchInput();
}} }}
> >
<XMark className="size-3" strokeWidth="2" /> <XMark className="size-3" strokeWidth="2" />
+4 -2
View File
@@ -63,12 +63,12 @@
let showImportModal = false; let showImportModal = false;
$: if (query !== undefined) { const handleSearchInput = () => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
setFilteredItems(); setFilteredItems();
}, 300); }, 300);
} };
$: if (tools && viewOption !== undefined) { $: if (tools && viewOption !== undefined) {
setFilteredItems(); setFilteredItems();
@@ -325,6 +325,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
aria-label={$i18n.t('Search Tools')} aria-label={$i18n.t('Search Tools')}
placeholder={$i18n.t('Search Tools')} placeholder={$i18n.t('Search Tools')}
/> />
@@ -335,6 +336,7 @@
aria-label={$i18n.t('Clear search')} aria-label={$i18n.t('Clear search')}
on:click={() => { on:click={() => {
query = ''; query = '';
handleSearchInput();
}} }}
> >
<XMark className="size-3" strokeWidth="2" /> <XMark className="size-3" strokeWidth="2" />
@@ -63,12 +63,12 @@
} }
}; };
$: if (query !== undefined) { const handleSearchInput = () => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
getUserList(); getUserList();
}, 300); }, 300);
} };
onDestroy(() => { onDestroy(() => {
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
@@ -187,6 +187,7 @@
<input <input
class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent" class=" w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
placeholder={$i18n.t('Search')} placeholder={$i18n.t('Search')}
/> />
</div> </div>
+11 -5
View File
@@ -50,15 +50,19 @@
let page = 1; let page = 1;
// Debounce only query changes (gate behind loaded to prevent double-fetch on mount) const handleSearchInput = () => {
$: if (loaded && query !== undefined) { if (!loaded) return;
loading = true; loading = true;
clearTimeout(searchDebounceTimer); clearTimeout(searchDebounceTimer);
searchDebounceTimer = setTimeout(() => { searchDebounceTimer = setTimeout(() => {
page = 1; if (page !== 1) {
getAutomationList(); page = 1;
} else {
getAutomationList();
}
}, 300); }, 300);
} };
// Immediate response to page/filter changes (gate behind loaded) // Immediate response to page/filter changes (gate behind loaded)
$: if (loaded && page && statusFilter !== undefined) { $: if (loaded && page && statusFilter !== undefined) {
@@ -296,6 +300,7 @@
<input <input
class="w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent" class="w-full text-sm py-1 rounded-r-xl outline-hidden bg-transparent"
bind:value={query} bind:value={query}
on:input={handleSearchInput}
aria-label={$i18n.t('Search Automations')} aria-label={$i18n.t('Search Automations')}
placeholder={$i18n.t('Search Automations')} placeholder={$i18n.t('Search Automations')}
maxlength="500" maxlength="500"
@@ -308,6 +313,7 @@
aria-label={$i18n.t('Clear search')} aria-label={$i18n.t('Clear search')}
on:click={() => { on:click={() => {
query = ''; query = '';
handleSearchInput();
}} }}
> >
<XMark className="size-3" strokeWidth="2" /> <XMark className="size-3" strokeWidth="2" />