diff --git a/frontend/src/lib/components/flows/pickers/PickHubScript.svelte b/frontend/src/lib/components/flows/pickers/PickHubScript.svelte index a1ca1a167c..c9185bf0bf 100644 --- a/frontend/src/lib/components/flows/pickers/PickHubScript.svelte +++ b/frontend/src/lib/components/flows/pickers/PickHubScript.svelte @@ -74,7 +74,9 @@ async function applyFilter( filter: string, filterKind: typeof kind, - appFilter: string | undefined + appFilter: string | undefined, + summaryFilter: string | undefined, + pathFilter: string | undefined ) { if ($disableHubStore) return try { @@ -84,10 +86,11 @@ startTs = ts await new Promise((r) => setTimeout(r, 100)) if (ts < startTs) return + const queryText = [filter, summaryFilter, pathFilter].filter(Boolean).join(' ') const scripts = - filter.length > 0 + queryText.length > 0 ? await ScriptService.queryHubScripts({ - text: `${filter}`, + text: queryText, limit: 20, kind: filterKind, app: appFilter @@ -138,23 +141,9 @@ dispatch('pick', item) } - // Apply summary/path post-filters - let displayItems = $derived.by(() => { - let result = items - if (summaryFilter) { - const s = summaryFilter.toLowerCase() - result = result.filter((x) => (x.summary ?? '').toLowerCase().includes(s)) - } - if (pathFilter) { - const p = pathFilter.toLowerCase() - result = result.filter((x) => (x.path ?? '').toLowerCase().includes(p)) - } - return result - }) - $effect(() => { - ;[filter, kind, appFilter] - untrack(() => applyFilter(filter, kind, appFilter)) + ;[filter, kind, appFilter, summaryFilter, pathFilter] + untrack(() => applyFilter(filter, kind, appFilter, summaryFilter, pathFilter)) }) $effect(() => { kind @@ -193,11 +182,11 @@ {#if !hideSearchbar} {/if} - {#if displayItems.length == 0} + {#if items.length == 0} {:else}