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:
Andrey Antukh 2026-04-21 21:17:33 +00:00 committed by Belén Albeza
parent a94a7221fb
commit d28c0ea066

View File

@ -323,10 +323,12 @@
:attributes #{:typography}
:token token
:on-update-shape dwta/update-typography})))))
label (case type
:multiple (tr "workspace.options.text-options.title-selection")
:group (tr "workspace.options.text-options.title-group")
(tr "workspace.options.text-options.title"))
label
(mf/with-memo [type]
(case type
: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
(mf/use-fn
(fn [node]