fix(app): file listing (#8309)
This commit is contained in:
@@ -24,16 +24,12 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
|
|||||||
const [grouped, { refetch }] = createResource(
|
const [grouped, { refetch }] = createResource(
|
||||||
() => ({
|
() => ({
|
||||||
filter: store.filter,
|
filter: store.filter,
|
||||||
items:
|
items: typeof props.items === "function" ? props.items(store.filter) : props.items,
|
||||||
typeof props.items === "function"
|
|
||||||
? props.items.length === 0
|
|
||||||
? (props.items as () => T[])()
|
|
||||||
: undefined
|
|
||||||
: props.items,
|
|
||||||
}),
|
}),
|
||||||
async ({ filter, items }) => {
|
async ({ filter, items }) => {
|
||||||
const needle = filter?.toLowerCase()
|
const query = filter ?? ""
|
||||||
const all = (items ?? (await (props.items as (filter: string) => T[] | Promise<T[]>)(needle))) || []
|
const needle = query.toLowerCase()
|
||||||
|
const all = (await Promise.resolve(items)) || []
|
||||||
const result = pipe(
|
const result = pipe(
|
||||||
all,
|
all,
|
||||||
(x) => {
|
(x) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user