diff options
| author | Filip <[email protected]> | 2026-01-14 14:09:36 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-14 07:09:36 -0600 |
| commit | ee6ca104e5eb1693b63901128ea315754f88f595 (patch) | |
| tree | 1035eb4953a5a16c6b367a59330f84c6aa9f186c | |
| parent | 4347a77d89a0b397b2e5aa6165f33313f7fbaf6e (diff) | |
| download | opencode-ee6ca104e5eb1693b63901128ea315754f88f595.tar.gz opencode-ee6ca104e5eb1693b63901128ea315754f88f595.zip | |
fix(app): file listing (#8309)
| -rw-r--r-- | packages/ui/src/hooks/use-filtered-list.tsx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/packages/ui/src/hooks/use-filtered-list.tsx b/packages/ui/src/hooks/use-filtered-list.tsx index 26215e93c..b8a55000e 100644 --- a/packages/ui/src/hooks/use-filtered-list.tsx +++ b/packages/ui/src/hooks/use-filtered-list.tsx @@ -24,16 +24,12 @@ export function useFilteredList<T>(props: FilteredListProps<T>) { const [grouped, { refetch }] = createResource( () => ({ filter: store.filter, - items: - typeof props.items === "function" - ? props.items.length === 0 - ? (props.items as () => T[])() - : undefined - : props.items, + items: typeof props.items === "function" ? props.items(store.filter) : props.items, }), async ({ filter, items }) => { - const needle = filter?.toLowerCase() - const all = (items ?? (await (props.items as (filter: string) => T[] | Promise<T[]>)(needle))) || [] + const query = filter ?? "" + const needle = query.toLowerCase() + const all = (await Promise.resolve(items)) || [] const result = pipe( all, (x) => { |
