fix(app): file search

This commit is contained in:
Adam
2026-01-13 06:55:21 -06:00
parent 1facf7d8e4
commit f3b7d2f786

View File

@@ -22,18 +22,10 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
const empty: Group[] = []
const [grouped, { refetch }] = createResource(
() => {
// 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,
}
},
() => ({
filter: store.filter,
items: typeof props.items === "function" ? undefined : props.items,
}),
async ({ filter, items }) => {
const needle = filter?.toLowerCase()
const all = (items ?? (await (props.items as (filter: string) => T[] | Promise<T[]>)(needle))) || []