diff options
| author | OpeOginni <[email protected]> | 2026-01-12 22:26:58 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-12 15:26:58 -0600 |
| commit | b3a1360ad9d29811e672ba714dd006ee732d5a7b (patch) | |
| tree | 8eeaf6c3700cdabfa566e016c3411726a0eb20ae /packages/ui/src/hooks | |
| parent | 08d4d6d4af2f94d2e527fda9deebeb6bbd1e25b9 (diff) | |
| download | opencode-b3a1360ad9d29811e672ba714dd006ee732d5a7b.tar.gz opencode-b3a1360ad9d29811e672ba714dd006ee732d5a7b.zip | |
feat(dialog-select-server): add icon button for server removal (#8053)
Diffstat (limited to 'packages/ui/src/hooks')
| -rw-r--r-- | packages/ui/src/hooks/use-filtered-list.tsx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/ui/src/hooks/use-filtered-list.tsx b/packages/ui/src/hooks/use-filtered-list.tsx index 1b3be4b4c..11bc35548 100644 --- a/packages/ui/src/hooks/use-filtered-list.tsx +++ b/packages/ui/src/hooks/use-filtered-list.tsx @@ -22,10 +22,17 @@ export function useFilteredList<T>(props: FilteredListProps<T>) { const empty: Group[] = [] const [grouped, { refetch }] = createResource( - () => ({ - filter: store.filter, - items: typeof props.items === "function" ? undefined : props.items, - }), + () => { + // When items is a function (not async filter function), call it to track changes + const itemsValue = typeof props.items === "function" + ? (props.items as () => T[])() // Call synchronous function to track it + : props.items + + return { + filter: store.filter, + items: itemsValue, + } + }, async ({ filter, items }) => { const needle = filter?.toLowerCase() const all = (items ?? (await (props.items as (filter: string) => T[] | Promise<T[]>)(needle))) || [] |
