mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
🐛 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:
parent
50c27aecc7
commit
b68e400cc1
@ -38,6 +38,7 @@
|
|||||||
- Fix incorrect query for file versions [Github #8463](https://github.com/penpot/penpot/pull/8463)
|
- 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 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 '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
|
## 2.13.3
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,8 @@
|
|||||||
[options id]
|
[options id]
|
||||||
(let [options (if (delay? options) @options options)]
|
(let [options (if (delay? options) @options options)]
|
||||||
(or (d/seek #(= id (get % :id)) options)
|
(or (d/seek #(= id (get % :id)) options)
|
||||||
(nth options 0))))
|
(when (seq options)
|
||||||
|
(nth options 0)))))
|
||||||
|
|
||||||
(defn- get-selected-option-id
|
(defn- get-selected-option-id
|
||||||
[options default]
|
[options default]
|
||||||
@ -178,7 +179,8 @@
|
|||||||
|
|
||||||
selected-option
|
selected-option
|
||||||
(mf/with-memo [options selected-id]
|
(mf/with-memo [options selected-id]
|
||||||
(get-option options selected-id))
|
(when (d/not-empty? options)
|
||||||
|
(get-option options selected-id)))
|
||||||
|
|
||||||
label
|
label
|
||||||
(get selected-option :label)
|
(get selected-option :label)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user