🐛 Fix form select label resetting to its default option (#11664)

select* resets its label to `default-selected` whenever its options
change identity. The access token dialog builds its options vector
inline, so picking an expiration re-rendered the dialog and the label
snapped back to "Never", although the form kept the picked value and
the token was created with it.

form-select* now passes the form value as `default-selected` when it
holds a non-blank string, so the reset lands on the picked option. The
caller's default still applies while the form value is blank.

Closes #11663

AI-assisted-by: claude-opus-5

Signed-off-by: chulgil <2044587+chulgil@users.noreply.github.com>
Co-authored-by: chulgil <2044587+chulgil@users.noreply.github.com>
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
Chulgil Lee 2026-09-16 01:54:58 +09:00 committed by Andrey Antukh
parent 1f64cc3e52
commit cdda6ae33c

View File

@ -204,7 +204,17 @@
props
(mf/spread-props props {:on-change handle-change
:value value})]
:value value})
;; select* resets its label to `default-selected` whenever its
;; options change identity, and callers usually build the options
;; inline, so every re-render snapped the label back to the default
;; while the form kept the picked value. Pass the form value as the
;; default so that reset lands on the picked option.
props
(if (and (string? value) (not (str/blank? value)))
(mf/spread-props props {:default-selected value})
props)]
[:> select* props]))