🐛 Fix crash in select* when options vector is empty (#8578)

Guard get-option fallback with (when (seq options) ...) to avoid
"No item 0 in vector of length 0" when options is an empty vector.
Also guard the selected-option memo in select* to mirror the same
pattern already present in combobox*.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
Andrey Antukh
2026-03-12 13:06:25 +01:00
committed by GitHub
parent 50c27aecc7
commit b68e400cc1
2 changed files with 5 additions and 2 deletions

View File

@@ -38,6 +38,7 @@
- Fix incorrect query for file versions [Github #8463](https://github.com/penpot/penpot/pull/8463)
- Fix warning when clicking on number token pills [Taiga #13661](https://tree.taiga.io/project/penpot/issue/13661)
- Fix 'not ISeqable' error when entering float values in layout item and opacity inputs [Github #8569](https://github.com/penpot/penpot/pull/8569)
- Fix crash in select component when options vector is empty [Github #8578](https://github.com/penpot/penpot/pull/8578)
## 2.13.3

View File

@@ -22,7 +22,8 @@
[options id]
(let [options (if (delay? options) @options options)]
(or (d/seek #(= id (get % :id)) options)
(nth options 0))))
(when (seq options)
(nth options 0)))))
(defn- get-selected-option-id
[options default]
@@ -178,7 +179,8 @@
selected-option
(mf/with-memo [options selected-id]
(get-option options selected-id))
(when (d/not-empty? options)
(get-option options selected-id)))
label
(get selected-option :label)