From c504e38f6d329d84d897dbcd7b92d8ca25fc8993 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 29 Jan 2025 18:55:08 +0100 Subject: [PATCH] :bug: Fix incorrect key setup on color selection menu --- .../sidebar/options/menus/color_selection.cljs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs index 1e6973f10..f6b753ba1 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs @@ -8,9 +8,7 @@ (:require-macros [app.main.style :as stl]) (:require [app.common.data :as d] - [app.common.data.macros :as dm] [app.common.types.color :as ctc] - [app.common.uuid :as uuid] [app.main.data.workspace.colors :as dc] [app.main.data.workspace.selection :as dws] [app.main.store :as st] @@ -57,15 +55,6 @@ groups-ref (h/use-ref-value groups) prev-colors-ref (mf/use-ref nil) - initial-color-keys - (mf/with-memo [] - (->> (concat colors library-colors) - (reduce (fn [result color] - (assoc result color (dm/str (uuid/next)))) - {}))) - - color-keys* (mf/use-var initial-color-keys) - on-change (mf/use-fn (fn [new-color old-color from-picker?] @@ -93,7 +82,6 @@ (mf/set-ref-val! prev-colors-ref (conj prev-colors color)))) - (swap! color-keys* assoc new-color (get @color-keys* old-color)) (st/emit! (dc/change-color-in-selected cops new-color old-color))))) on-open @@ -138,7 +126,7 @@ lib-colors (concat lib-colors colors)] (for [[index color] (d/enumerate lib-colors)] [:> color-row* - {:key (get @color-keys* color) + {:key index :color color :index index :hidden (not (:id color)) @@ -155,7 +143,7 @@ [:div {:class (stl/css :selected-color-group)} (for [[index color] (d/enumerate (cond->> colors (not @expand-color) (take 3)))] [:> color-row* - {:key (get @color-keys* color) + {:key index :color color :index index :select-only select-only