mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 22:21:43 +02:00
💄 Minor cosmetic change on frame memo equals func.
This commit is contained in:
parent
7db2db96e1
commit
d007bdf813
1 changed files with 17 additions and 21 deletions
|
@ -31,32 +31,28 @@
|
||||||
(declare frame-shape)
|
(declare frame-shape)
|
||||||
(declare translate-to-frame)
|
(declare translate-to-frame)
|
||||||
|
|
||||||
(defn wrap-memo-frame
|
(defn frame-wrapper-memo-equals?
|
||||||
([component]
|
[np op]
|
||||||
(mf/memo'
|
(let [n-shape (aget np "shape")
|
||||||
component
|
o-shape (aget op "shape")
|
||||||
(fn [np op]
|
n-objs (aget np "objects")
|
||||||
(let [n-shape (aget np "shape")
|
o-objs (aget op "objects")
|
||||||
o-shape (aget op "shape")
|
|
||||||
n-objs (aget np "objects")
|
|
||||||
o-objs (aget op "objects")
|
|
||||||
|
|
||||||
ids (:shapes n-shape)]
|
|
||||||
(and (identical? n-shape o-shape)
|
|
||||||
(loop [id (first ids)
|
|
||||||
ids (rest ids)]
|
|
||||||
(if (nil? id)
|
|
||||||
true
|
|
||||||
(if (identical? (get n-objs id)
|
|
||||||
(get o-objs id))
|
|
||||||
(recur (first ids) (rest ids))
|
|
||||||
false)))))))))
|
|
||||||
|
|
||||||
|
ids (:shapes n-shape)]
|
||||||
|
(and (identical? n-shape o-shape)
|
||||||
|
(loop [id (first ids)
|
||||||
|
ids (rest ids)]
|
||||||
|
(if (nil? id)
|
||||||
|
true
|
||||||
|
(if (identical? (get n-objs id)
|
||||||
|
(get o-objs id))
|
||||||
|
(recur (first ids) (rest ids))
|
||||||
|
false))))))
|
||||||
|
|
||||||
(defn frame-wrapper
|
(defn frame-wrapper
|
||||||
[shape-wrapper]
|
[shape-wrapper]
|
||||||
(mf/fnc frame-wrapper
|
(mf/fnc frame-wrapper
|
||||||
{::mf/wrap [wrap-memo-frame]}
|
{::mf/wrap [#(mf/memo' % frame-wrapper-memo-equals?)]}
|
||||||
[{:keys [shape objects] :as props}]
|
[{:keys [shape objects] :as props}]
|
||||||
(let [selected-iref (-> (mf/deps (:id shape))
|
(let [selected-iref (-> (mf/deps (:id shape))
|
||||||
(mf/use-memo #(refs/make-selected (:id shape))))
|
(mf/use-memo #(refs/make-selected (:id shape))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue