From 9fcbe0df011b11d5fa7c134001f72862090df93d Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Tue, 17 Mar 2026 14:00:03 +0100 Subject: [PATCH] Revert "fix: fallback to client-side filtering when queryHubScripts is unavailable" This reverts commit 4f6da9a6a5fe74abff9c3331590ecbffc4e89dc8. --- .../flows/pickers/PickHubScript.svelte | 43 ++++++------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/frontend/src/lib/components/flows/pickers/PickHubScript.svelte b/frontend/src/lib/components/flows/pickers/PickHubScript.svelte index ef2b752e4b..a1ca1a167c 100644 --- a/frontend/src/lib/components/flows/pickers/PickHubScript.svelte +++ b/frontend/src/lib/components/flows/pickers/PickHubScript.svelte @@ -84,40 +84,21 @@ startTs = ts await new Promise((r) => setTimeout(r, 100)) if (ts < startTs) return - let scripts: any[] - if (filter.length > 0) { - try { - scripts = await ScriptService.queryHubScripts({ - text: `${filter}`, - limit: 20, - kind: filterKind, - app: appFilter - }) - } catch { - // Fallback: load top scripts and filter client-side - const top = - ( + const scripts = + filter.length > 0 + ? await ScriptService.queryHubScripts({ + text: `${filter}`, + limit: 20, + kind: filterKind, + app: appFilter + }) + : (( await ScriptService.getTopHubScripts({ - limit: 40, + limit: 20, app: appFilter, kind: filterKind }) - ).asks ?? [] - const lc = filter.toLowerCase() - scripts = top.filter( - (x: any) => x.summary?.toLowerCase().includes(lc) || x.app?.toLowerCase().includes(lc) - ) - } - } else { - scripts = - ( - await ScriptService.getTopHubScripts({ - limit: 20, - app: appFilter, - kind: filterKind - }) - ).asks ?? [] - } + ).asks ?? []) if (ts === startTs) { loading = false } @@ -131,7 +112,7 @@ kind: HubScriptKind }) => ({ ...x, - path: `hub/${x.version_id}/${x.app}/${(x.summary ?? '').toLowerCase().replaceAll(/\s+/g, '_')}`, + path: `hub/${x.version_id}/${x.app}/${x.summary.toLowerCase().replaceAll(/\s+/g, '_')}`, summary: `${x.summary} (${x.app})` }) )