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