mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 17:00:36 -05:00
🐛 Fix react warning on color-selection components
This commit is contained in:
parent
258969f342
commit
f127b5c6ea
1 changed files with 8 additions and 5 deletions
|
@ -152,8 +152,9 @@
|
||||||
:library-colors library-colors}))
|
:library-colors library-colors}))
|
||||||
|
|
||||||
(mf/defc color-selection-menu
|
(mf/defc color-selection-menu
|
||||||
{::mf/wrap [#(mf/memo' % (mf/check-props ["shapes"]))]}
|
{::mf/wrap [#(mf/memo' % (mf/check-props ["shapes"]))]
|
||||||
[{:keys [shapes file-id shared-libs] :as props}]
|
::mf/wrap-props false}
|
||||||
|
[{:keys [shapes file-id shared-libs]}]
|
||||||
(let [{:keys [grouped-colors library-colors colors]} (mf/with-memo [shapes file-id shared-libs]
|
(let [{:keys [grouped-colors library-colors colors]} (mf/with-memo [shapes file-id shared-libs]
|
||||||
(prepare-colors shapes file-id shared-libs))
|
(prepare-colors shapes file-id shared-libs))
|
||||||
|
|
||||||
|
@ -175,7 +176,9 @@
|
||||||
(fn [new-color old-color from-picker?]
|
(fn [new-color old-color from-picker?]
|
||||||
(let [old-color (-> old-color (dissoc :name :path) d/without-nils)
|
(let [old-color (-> old-color (dissoc :name :path) d/without-nils)
|
||||||
|
|
||||||
;; When dragging on the color picker sometimes all the shapes hasn't updated the color to the prev value so we need this extra calculation
|
;; When dragging on the color picker sometimes all
|
||||||
|
;; the shapes hasn't updated the color to the prev
|
||||||
|
;; value so we need this extra calculation
|
||||||
shapes-by-old-color (get @grouped-colors* old-color)
|
shapes-by-old-color (get @grouped-colors* old-color)
|
||||||
prev-color (d/seek #(get @grouped-colors* %) @prev-colors*)
|
prev-color (d/seek #(get @grouped-colors* %) @prev-colors*)
|
||||||
shapes-by-prev-color (get @grouped-colors* prev-color)
|
shapes-by-prev-color (get @grouped-colors* prev-color)
|
||||||
|
@ -225,7 +228,7 @@
|
||||||
[:div {:class (stl/css :element-content)}
|
[:div {:class (stl/css :element-content)}
|
||||||
[:div {:class (stl/css :selected-color-group)}
|
[:div {:class (stl/css :selected-color-group)}
|
||||||
(for [[index color] (d/enumerate (take 3 library-colors))]
|
(for [[index color] (d/enumerate (take 3 library-colors))]
|
||||||
[:& color-row {:key (dm/str "library-color-" (:color color))
|
[:& color-row {:key (dm/str "library-color-" index)
|
||||||
:color color
|
:color color
|
||||||
:index index
|
:index index
|
||||||
:on-detach on-detach
|
:on-detach on-detach
|
||||||
|
@ -239,7 +242,7 @@
|
||||||
(tr "workspace.options.more-lib-colors")])
|
(tr "workspace.options.more-lib-colors")])
|
||||||
(when @expand-lib-color
|
(when @expand-lib-color
|
||||||
(for [[index color] (d/enumerate (drop 3 library-colors))]
|
(for [[index color] (d/enumerate (drop 3 library-colors))]
|
||||||
[:& color-row {:key (dm/str "library-color-" (:color color))
|
[:& color-row {:key (dm/str "library-color-" index)
|
||||||
:color color
|
:color color
|
||||||
:index index
|
:index index
|
||||||
:on-detach on-detach
|
:on-detach on-detach
|
||||||
|
|
Loading…
Reference in a new issue