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} :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]