mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
🐛 Fix react warning on incorrect hooks usage on shapes components
This commit is contained in:
parent
b943a034c9
commit
645b7e4b8d
3 changed files with 10 additions and 4 deletions
|
@ -8,6 +8,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
|
[app.main.ui.context :as muc]
|
||||||
[app.main.ui.shapes.attrs :as attrs]
|
[app.main.ui.shapes.attrs :as attrs]
|
||||||
[app.main.ui.shapes.custom-stroke :refer [shape-custom-strokes]]
|
[app.main.ui.shapes.custom-stroke :refer [shape-custom-strokes]]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
|
@ -30,8 +31,10 @@
|
||||||
rx (/ w 2)
|
rx (/ w 2)
|
||||||
ry (/ h 2)
|
ry (/ h 2)
|
||||||
|
|
||||||
|
rid (mf/use-ctx muc/render-id)
|
||||||
|
|
||||||
props (mf/with-memo [shape]
|
props (mf/with-memo [shape]
|
||||||
(-> (attrs/extract-style-attrs shape)
|
(-> (attrs/extract-style-attrs shape rid)
|
||||||
(obj/merge! #js {:cx cx :cy cy :rx rx :ry ry :transform t})))]
|
(obj/merge! #js {:cx cx :cy cy :rx rx :ry ry :transform t})))]
|
||||||
|
|
||||||
[:& shape-custom-strokes {:shape shape}
|
[:& shape-custom-strokes {:shape shape}
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
h (dm/get-prop shape :height)
|
h (dm/get-prop shape :height)
|
||||||
t (gsh/transform-str shape)
|
t (gsh/transform-str shape)
|
||||||
|
|
||||||
props (mf/with-memo [shape]
|
props (mf/with-memo [shape render-id]
|
||||||
(-> (attrs/extract-style-attrs shape)
|
(-> (attrs/extract-style-attrs shape render-id)
|
||||||
(obj/merge! #js {:x x :y y :width w :height h :transform t})))
|
(obj/merge! #js {:x x :y y :width w :height h :transform t})))
|
||||||
|
|
||||||
path? (some? (.-d props))]
|
path? (some? (.-d props))]
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
(ns app.main.ui.shapes.image
|
(ns app.main.ui.shapes.image
|
||||||
(:require
|
(:require
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
|
[app.main.ui.context :as muc]
|
||||||
[app.main.ui.shapes.attrs :as attrs]
|
[app.main.ui.shapes.attrs :as attrs]
|
||||||
[app.main.ui.shapes.custom-stroke :refer [shape-custom-strokes]]
|
[app.main.ui.shapes.custom-stroke :refer [shape-custom-strokes]]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
|
@ -18,8 +19,10 @@
|
||||||
|
|
||||||
(let [shape (unchecked-get props "shape")
|
(let [shape (unchecked-get props "shape")
|
||||||
{:keys [x y width height]} shape
|
{:keys [x y width height]} shape
|
||||||
|
|
||||||
|
render-id (mf/use-ctx muc/render-id)
|
||||||
transform (gsh/transform-str shape)
|
transform (gsh/transform-str shape)
|
||||||
props (-> (attrs/extract-style-attrs shape)
|
props (-> (attrs/extract-style-attrs shape render-id)
|
||||||
(obj/merge! (attrs/extract-border-radius-attrs shape))
|
(obj/merge! (attrs/extract-border-radius-attrs shape))
|
||||||
(obj/merge!
|
(obj/merge!
|
||||||
#js {:x x
|
#js {:x x
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue