feat(dialog-select-server): add icon button for server removal (#8053)

This commit is contained in:
OpeOginni
2026-01-12 22:26:58 +01:00
committed by GitHub
parent 08d4d6d4af
commit b3a1360ad9
2 changed files with 42 additions and 17 deletions

View File

@@ -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))) || []