Skip to content

Commit 4e1b6b3

Browse files
committed
fix(app): select first item when filtering
1 parent 2d52a46 commit 4e1b6b3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/ui/src/hooks/use-filtered-list.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fuzzysort from "fuzzysort"
22
import { entries, flatMap, groupBy, map, pipe } from "remeda"
3-
import { createMemo, createResource } from "solid-js"
3+
import { createEffect, createMemo, createResource, on } from "solid-js"
44
import { createStore } from "solid-js/store"
55
import { createList } from "solid-list"
66

@@ -86,9 +86,14 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
8686
}
8787
}
8888

89+
createEffect(
90+
on(grouped, () => {
91+
reset()
92+
}),
93+
)
94+
8995
const onInput = (value: string) => {
9096
setStore("filter", value)
91-
reset()
9297
}
9398

9499
return {

0 commit comments

Comments
 (0)