Current item now auto-selected when dialog opens
Some checks failed
format / format (push) Has been cancelled
test / test (push) Has been cancelled

Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot] 2025-11-07 16:33:50 +00:00
parent 3adbcd73b2
commit 9eb87988f7

View file

@ -89,6 +89,13 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
const selected = createMemo(() => flat()[store.selected])
createEffect(() => {
const currentIndex = flat().findIndex((x) => isDeepEqual(x.value, props.current))
if (currentIndex >= 0 && store.filter === "") {
setStore("selected", currentIndex)
}
})
createEffect(() => {
store.filter
setStore("selected", 0)