0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-23 15:26:29 -05:00

Add missing use-memo on page-menu

This commit is contained in:
Andrey Antukh 2025-01-29 21:20:44 +01:00
parent 01268ea14e
commit 8f37cd2c07
2 changed files with 10 additions and 8 deletions

View file

@ -116,7 +116,7 @@
:shared-libs shared-libs}]
(= 0 (count selected))
[:& page/options]
[:> page/options*]
(= 1 (count selected))
[:> shape-options*

View file

@ -24,14 +24,18 @@
(-> (l/key :background)
(l/derived refs/workspace-page)))
(mf/defc options
{::mf/wrap [mf/memo]
::mf/wrap-props false}
(mf/defc options*
{::mf/wrap [mf/memo]}
[]
(let [background (mf/deref ref:background-color)
on-change (mf/use-fn #(st/emit! (dw/change-canvas-color %)))
on-open (mf/use-fn #(st/emit! (dwu/start-undo-transaction :options)))
on-close (mf/use-fn #(st/emit! (dwu/commit-undo-transaction :options)))]
on-close (mf/use-fn #(st/emit! (dwu/commit-undo-transaction :options)))
color (mf/with-memo [background]
{:color (d/nilv background clr/canvas)
:opacity 1})]
[:div {:class (stl/css :element-set)}
[:div {:class (stl/css :element-title)}
[:& title-bar {:collapsable false
@ -39,14 +43,12 @@
:class (stl/css :title-spacing-page)}]]
[:div {:class (stl/css :element-content)}
;; FIXME: memoize color
[:> color-row*
{:disable-gradient true
:disable-opacity true
:disable-image true
:title (tr "workspace.options.canvas-background")
:color {:color (d/nilv background clr/canvas)
:opacity 1}
:color color
:on-change on-change
:on-open on-open
:on-close on-close}]]]))