mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 08:16:37 +02:00
♻️ Replace wrap-memo with memo.
This commit is contained in:
parent
6ba4531d18
commit
c907126b60
10 changed files with 16 additions and 16 deletions
|
@ -35,7 +35,7 @@
|
||||||
(str (t locale "ds.updated-at" time))))
|
(str (t locale "ds.updated-at" time))))
|
||||||
|
|
||||||
(mf/defc grid-item
|
(mf/defc grid-item
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [file] :as props}]
|
[{:keys [file] :as props}]
|
||||||
(let [local (mf/use-state {:menu-open false
|
(let [local (mf/use-state {:menu-open false
|
||||||
:edition false})
|
:edition false})
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
children]]])))
|
children]]])))
|
||||||
|
|
||||||
(mf/defc frame-svg
|
(mf/defc frame-svg
|
||||||
{::mf/wrap [mf/wrap-memo]}
|
{::mf/wrap [mf/memo]}
|
||||||
[{:keys [objects frame zoom] :or {zoom 1} :as props}]
|
[{:keys [objects frame zoom] :or {zoom 1} :as props}]
|
||||||
(let [childs (mapv #(get objects %) (:shapes frame))
|
(let [childs (mapv #(get objects %) (:shapes frame))
|
||||||
modifier (-> (gpt/point (:x frame) (:y frame))
|
modifier (-> (gpt/point (:x frame) (:y frame))
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
(l/derive refs/workspace-data)))
|
(l/derive refs/workspace-data)))
|
||||||
|
|
||||||
(mf/defc grid
|
(mf/defc grid
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[props]
|
[props]
|
||||||
(prn "grid$render")
|
(prn "grid$render")
|
||||||
(let [options (mf/deref options-iref)
|
(let [options (mf/deref options-iref)
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
;; --- Zoom Widget
|
;; --- Zoom Widget
|
||||||
|
|
||||||
(mf/defc zoom-widget
|
(mf/defc zoom-widget
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[props]
|
[props]
|
||||||
(let [zoom (mf/deref refs/selected-zoom)
|
(let [zoom (mf/deref refs/selected-zoom)
|
||||||
show-dropdown? (mf/use-state false)
|
show-dropdown? (mf/use-state false)
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
;; --- Horizontal Rule Ticks (Component)
|
;; --- Horizontal Rule Ticks (Component)
|
||||||
|
|
||||||
(mf/defc horizontal-rule-ticks
|
(mf/defc horizontal-rule-ticks
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [zoom]}]
|
[{:keys [zoom]}]
|
||||||
(let [path (reduce (partial make-vertical-tick zoom) [] +ticks+)]
|
(let [path (reduce (partial make-vertical-tick zoom) [] +ticks+)]
|
||||||
[:g
|
[:g
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
;; --- Vertical Rule Ticks (Component)
|
;; --- Vertical Rule Ticks (Component)
|
||||||
|
|
||||||
(mf/defc vertical-rule-ticks
|
(mf/defc vertical-rule-ticks
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [zoom]}]
|
[{:keys [zoom]}]
|
||||||
(let [path (reduce (partial make-horizontal-tick zoom) [] +ticks+)]
|
(let [path (reduce (partial make-horizontal-tick zoom) [] +ticks+)]
|
||||||
[:g
|
[:g
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
;; --- Horizontal Rule (Component)
|
;; --- Horizontal Rule (Component)
|
||||||
|
|
||||||
(mf/defc horizontal-rule
|
(mf/defc horizontal-rule
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[props]
|
[props]
|
||||||
(let [scroll (use-rxsub ms/viewport-scroll)
|
(let [scroll (use-rxsub ms/viewport-scroll)
|
||||||
zoom (mf/deref refs/selected-zoom)
|
zoom (mf/deref refs/selected-zoom)
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
;; --- Vertical Rule (Component)
|
;; --- Vertical Rule (Component)
|
||||||
|
|
||||||
(mf/defc vertical-rule
|
(mf/defc vertical-rule
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[props]
|
[props]
|
||||||
(let [scroll (use-rxsub ms/viewport-scroll)
|
(let [scroll (use-rxsub ms/viewport-scroll)
|
||||||
zoom (or (mf/deref refs/selected-zoom) 1)
|
zoom (or (mf/deref refs/selected-zoom) 1)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
;; --- Left Sidebar (Component)
|
;; --- Left Sidebar (Component)
|
||||||
|
|
||||||
(mf/defc left-sidebar
|
(mf/defc left-sidebar
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [layout page file] :as props}]
|
[{:keys [layout page file] :as props}]
|
||||||
[:aside.settings-bar.settings-bar-left
|
[:aside.settings-bar.settings-bar-left
|
||||||
[:div.settings-bar-inside
|
[:div.settings-bar-inside
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
#(select-keys % [:id :frame :name :type :hidden :blocked]))
|
#(select-keys % [:id :frame :name :type :hidden :blocked]))
|
||||||
|
|
||||||
(mf/defc layer-item
|
(mf/defc layer-item
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [index item selected objects] :as props}]
|
[{:keys [index item selected objects] :as props}]
|
||||||
(let [selected? (contains? selected (:id item))
|
(let [selected? (contains? selected (:id item))
|
||||||
local (mf/use-state {:collapsed false})
|
local (mf/use-state {:collapsed false})
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
:key (:id item)}]))])]))
|
:key (:id item)}]))])]))
|
||||||
|
|
||||||
(mf/defc layers-tree
|
(mf/defc layers-tree
|
||||||
{::mf/wrap [mf/wrap-memo]}
|
{::mf/wrap [mf/memo]}
|
||||||
[props]
|
[props]
|
||||||
(let [selected (mf/deref refs/selected-shapes)
|
(let [selected (mf/deref refs/selected-shapes)
|
||||||
data (mf/deref refs/workspace-data)
|
data (mf/deref refs/workspace-data)
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
;; only render visible items instead of all.
|
;; only render visible items instead of all.
|
||||||
|
|
||||||
(mf/defc layers-toolbox
|
(mf/defc layers-toolbox
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [page] :as props}]
|
[{:keys [page] :as props}]
|
||||||
(let [locale (i18n/use-locale)
|
(let [locale (i18n/use-locale)
|
||||||
on-click #(st/emit! (dw/toggle-layout-flag :layers))]
|
on-click #(st/emit! (dw/toggle-layout-flag :layers))]
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
[:& shape-options {:shape shape}]))
|
[:& shape-options {:shape shape}]))
|
||||||
|
|
||||||
(mf/defc options-toolbox
|
(mf/defc options-toolbox
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [page selected] :as props}]
|
[{:keys [page selected] :as props}]
|
||||||
(let [close #(st/emit! (udw/toggle-layout-flag :element-options))
|
(let [close #(st/emit! (udw/toggle-layout-flag :element-options))
|
||||||
selected (mf/deref refs/selected-shapes)]
|
selected (mf/deref refs/selected-shapes)]
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
(l/derive refs/workspace-data)))
|
(l/derive refs/workspace-data)))
|
||||||
|
|
||||||
(mf/defc grid-options
|
(mf/defc grid-options
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[props]
|
[props]
|
||||||
(let [options (->> (mf/deref options-iref)
|
(let [options (->> (mf/deref options-iref)
|
||||||
(merge default-options))
|
(merge default-options))
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
;; --- Selection Rect
|
;; --- Selection Rect
|
||||||
|
|
||||||
(mf/defc selection-rect
|
(mf/defc selection-rect
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [data] :as props}]
|
[{:keys [data] :as props}]
|
||||||
(when data
|
(when data
|
||||||
[:rect.selection-rect
|
[:rect.selection-rect
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
[:& frames {:data data}]))
|
[:& frames {:data data}]))
|
||||||
|
|
||||||
(mf/defc frames
|
(mf/defc frames
|
||||||
{:wrap [mf/wrap-memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [data] :as props}]
|
[{:keys [data] :as props}]
|
||||||
(let [objects (:objects data)
|
(let [objects (:objects data)
|
||||||
root (get objects uuid/zero)
|
root (get objects uuid/zero)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue