From 4b2d82e1005e4780c659c1500d7a7343a24c062f Mon Sep 17 00:00:00 2001 From: Aitor Moreno Date: Wed, 11 Jan 2023 10:20:26 +0100 Subject: [PATCH] :fix: react warning duplicate keys --- frontend/src/app/main/ui/shapes/frame.cljs | 5 +++-- .../src/app/main/ui/viewer/inspect/attributes.cljs | 5 +++-- .../app/main/ui/viewer/inspect/attributes/text.cljs | 11 ++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/main/ui/shapes/frame.cljs b/frontend/src/app/main/ui/shapes/frame.cljs index 7b87e065f8..702f956b78 100644 --- a/frontend/src/app/main/ui/shapes/frame.cljs +++ b/frontend/src/app/main/ui/shapes/frame.cljs @@ -113,9 +113,10 @@ {::mf/wrap-props false} [props] - (let [childs (unchecked-get props "childs")] + (let [childs (unchecked-get props "childs")] [:> frame-container props [:g.frame-children (for [item childs] - [:& shape-wrapper {:key (dm/str (:id item)) :shape item}])]]))) + [:& shape-wrapper {:key (dm/str (:id item)) :shape item}] + )]]))) diff --git a/frontend/src/app/main/ui/viewer/inspect/attributes.cljs b/frontend/src/app/main/ui/viewer/inspect/attributes.cljs index b956d8af88..cb43f937b8 100644 --- a/frontend/src/app/main/ui/viewer/inspect/attributes.cljs +++ b/frontend/src/app/main/ui/viewer/inspect/attributes.cljs @@ -39,7 +39,7 @@ type (if (= (count shapes) 1) (-> shapes first :type) :multiple) options (type->options type)] [:div.element-options - (for [option options] + (for [[idx option] (map-indexed vector options)] [:> (case option :layout layout-panel :layout-flex layout-flex-panel @@ -51,7 +51,8 @@ :image image-panel :text text-panel :svg svg-panel) - {:shapes shapes + {:key idx + :shapes shapes :frame frame :from from}]) [:& exports diff --git a/frontend/src/app/main/ui/viewer/inspect/attributes/text.cljs b/frontend/src/app/main/ui/viewer/inspect/attributes/text.cljs index 64e6b9790e..4d600a4f97 100644 --- a/frontend/src/app/main/ui/viewer/inspect/attributes/text.cljs +++ b/frontend/src/app/main/ui/viewer/inspect/attributes/text.cljs @@ -106,9 +106,9 @@ [:& copy-button {:data (copy-style-data style)}]]) (when (:fills style) - (for [fill (:fills style)] - - [:& color-row {:format @color-format + (for [[idx fill] (map-indexed vector (:fills style))] + [:& color-row {:key idx + :format @color-format :color (shape->color fill) :copy-data (copy-style-data fill :fill-color :fill-color-gradient) :on-change-format #(reset! color-format %)}])) @@ -175,8 +175,9 @@ (remove (fn [[_ text]] (str/empty? (str/trim text)))) (mapv (fn [[style text]] (vector (merge txt/default-text-attrs style) text))))] - (for [[_ [full-style text]] (map-indexed vector style-text-blocks)] - [:& typography-block {:shape shape + (for [[idx [full-style text]] (map-indexed vector style-text-blocks)] + [:& typography-block {:key idx + :shape shape :style full-style :text text}])))