mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
⚡ Memoize label computation in text-menu* component
Wrap the (case type (tr ...) ...) expression in mf/with-memo [type] so the translation is resolved only when the type prop changes instead of on every render. Signed-off-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
parent
a94a7221fb
commit
d28c0ea066
@ -323,10 +323,12 @@
|
|||||||
:attributes #{:typography}
|
:attributes #{:typography}
|
||||||
:token token
|
:token token
|
||||||
:on-update-shape dwta/update-typography})))))
|
:on-update-shape dwta/update-typography})))))
|
||||||
label (case type
|
label
|
||||||
:multiple (tr "workspace.options.text-options.title-selection")
|
(mf/with-memo [type]
|
||||||
:group (tr "workspace.options.text-options.title-group")
|
(case type
|
||||||
(tr "workspace.options.text-options.title"))
|
:multiple (tr "workspace.options.text-options.title-selection")
|
||||||
|
:group (tr "workspace.options.text-options.title-group")
|
||||||
|
(tr "workspace.options.text-options.title")))
|
||||||
set-option-ref
|
set-option-ref
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn [node]
|
(fn [node]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user