From b68e400cc17ff6859da5b993b442e9b41a73562d Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 12 Mar 2026 13:06:25 +0100 Subject: [PATCH] :bug: 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 --- CHANGES.md | 1 + frontend/src/app/main/ui/ds/controls/select.cljs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index d4fae89f5e..efbcd5b866 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/frontend/src/app/main/ui/ds/controls/select.cljs b/frontend/src/app/main/ui/ds/controls/select.cljs index 32676bcd36..d40d7275b8 100644 --- a/frontend/src/app/main/ui/ds/controls/select.cljs +++ b/frontend/src/app/main/ui/ds/controls/select.cljs @@ -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)