mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
Current item now auto-selected when dialog opens
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
parent
3adbcd73b2
commit
9eb87988f7
1 changed files with 7 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue