diff options
| author | Adam <[email protected]> | 2026-01-06 08:18:17 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2026-01-06 08:19:17 -0600 |
| commit | b88bcd49fdea0955f2efc8f09a3614c188d22107 (patch) | |
| tree | 8ab04d7a9d2b892cd884eab5ab3bb5da9187191a /packages/ui/src/hooks | |
| parent | 3f463bc9168abd907be9ae582e161ff89c3a27c9 (diff) | |
| download | opencode-b88bcd49fdea0955f2efc8f09a3614c188d22107.tar.gz opencode-b88bcd49fdea0955f2efc8f09a3614c188d22107.zip | |
fix(app): code splitting for web load perf gains
Diffstat (limited to 'packages/ui/src/hooks')
| -rw-r--r-- | packages/ui/src/hooks/use-filtered-list.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/ui/src/hooks/use-filtered-list.tsx b/packages/ui/src/hooks/use-filtered-list.tsx index 416f030ef..94099d786 100644 --- a/packages/ui/src/hooks/use-filtered-list.tsx +++ b/packages/ui/src/hooks/use-filtered-list.tsx @@ -18,6 +18,9 @@ export interface FilteredListProps<T> { export function useFilteredList<T>(props: FilteredListProps<T>) { const [store, setStore] = createStore<{ filter: string }>({ filter: "" }) + type Group = { category: string; items: [T, ...T[]] } + const empty: Group[] = [] + const [grouped, { refetch }] = createResource( () => ({ filter: store.filter, @@ -42,11 +45,12 @@ export function useFilteredList<T>(props: FilteredListProps<T>) { ) return result }, + { initialValue: empty }, ) const flat = createMemo(() => { return pipe( - grouped() || [], + grouped.latest || [], flatMap((x) => x.items), ) }) |
