From 9834f0596b71927b5955b840f4efd49c446ff4ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?luis=CE=B4=CE=BC?= Date: Wed, 30 Jul 2025 12:29:51 +0200 Subject: [PATCH] :bug: Fix move empty variant values to the end when component is selected (#7009) * :bug: Move empty variant values to the end when component is selected * :paperclip: PR changes --- .../sidebar/options/menus/component.cljs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs index 81adb84f01..b1d0d9e670 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs @@ -927,6 +927,14 @@ [:div ":touched " (str (:touched shape))])])]))) +(defn- move-empty-items-to-end + "Creates a new vector with the empty items at the end" + [v] + (-> [] + (into (remove empty?) v) + (into (filter empty?) v))) + + (mf/defc variant-menu* [{:keys [shapes]}] (let [multi? (> (count shapes) 1) @@ -1064,8 +1072,11 @@ (when-not multi? [:div {:class (stl/css :variant-property-list)} - (for [[pos property] (map vector (range) properties)] - (let [meta (str/join ", " (:value property))] + (for [[pos property] (map-indexed vector properties)] + (let [meta (->> (:value property) + (move-empty-items-to-end) + (replace {"" "--"}) + (str/join ", "))] [:div {:key (str (:id shape) pos) :class (stl/css :variant-property-row)} [:> input-with-meta* {:value (:name property)