mirror of
https://github.com/penpot/penpot.git
synced 2026-06-15 11:52:10 +00:00
⚡ Add memo to svg-attrs component
This commit is contained in:
parent
2e708af4d9
commit
cbf3658b04
@ -63,7 +63,19 @@
|
||||
:on-change on-change
|
||||
:on-delete on-delete}]])])]))
|
||||
|
||||
(defn- check-svg-attrs-menu-props
|
||||
[old-props new-props]
|
||||
(let [old-values (unchecked-get old-props "values")
|
||||
new-values (unchecked-get new-props "values")]
|
||||
(and (identical? (unchecked-get old-props "class")
|
||||
(unchecked-get new-props "class"))
|
||||
(identical? (unchecked-get old-props "ids")
|
||||
(unchecked-get new-props "ids"))
|
||||
(identical? (get old-values :svg-attrs)
|
||||
(get new-values :svg-attrs)))))
|
||||
|
||||
(mf/defc svg-attrs-menu*
|
||||
{::mf/wrap [#(mf/memo' % check-svg-attrs-menu-props)]}
|
||||
[{:keys [ids values]}]
|
||||
(let [state* (mf/use-state true)
|
||||
open? (deref state*)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user