mirror of
https://github.com/penpot/penpot.git
synced 2026-09-19 10:26:14 +00:00
🐛 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:
parent
38712aa29f
commit
8a1bb76ef6
@ -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]))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user