fix(tui): clamp dialog selection after options shrink (#36712)
This commit is contained in:
parent
90a87b2a0c
commit
ed1636e3bd
2 changed files with 120 additions and 2 deletions
|
|
@ -233,7 +233,11 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
|
|||
on(
|
||||
() => props.options,
|
||||
() => {
|
||||
if (!props.preserveSelection) return
|
||||
if (!props.preserveSelection) {
|
||||
const next = Math.min(store.selected, flat().length - 1)
|
||||
if (next >= 0 && next !== store.selected) setStore("selected", next)
|
||||
return
|
||||
}
|
||||
if (resetSelection && store.filter.length > 0) {
|
||||
const option = flat()[0]
|
||||
if (!option) return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue