From fdc3f0f17ddedcdac736d2d21c65bc1ea1edbfdc Mon Sep 17 00:00:00 2001 From: Nick Perez Date: Sat, 23 Nov 2024 22:07:37 +0100 Subject: perf: optimizations for composer with Tiptap (#6315) * chore: update tiptap packages * perf: reduce number of re-renders * refactor: apply min height without a layout effect * Remove stale zeed-dom resolution --------- Co-authored-by: Dan Abramov --- src/view/com/composer/text-input/TextInput.web.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/view/com/composer/text-input/TextInput.web.tsx b/src/view/com/composer/text-input/TextInput.web.tsx index 5c56e34c4..8ec4fefa8 100644 --- a/src/view/com/composer/text-input/TextInput.web.tsx +++ b/src/view/com/composer/text-input/TextInput.web.tsx @@ -225,6 +225,7 @@ export const TextInput = React.forwardRef(function TextInputImpl( autofocus: 'end', editable: true, injectCSS: true, + shouldRerenderOnTransaction: false, onCreate({editor: editorProp}) { // HACK // the 'enter' animation sometimes causes autofocus to fail @@ -317,15 +318,9 @@ export const TextInput = React.forwardRef(function TextInputImpl( style.lineHeight = style.lineHeight ? ((style.lineHeight + 'px') as unknown as number) : undefined + style.minHeight = webForceMinHeight ? 140 : undefined return style - }, [t, fonts]) - - React.useLayoutEffect(() => { - let node = editor?.view.dom - if (node) { - node.style.minHeight = webForceMinHeight ? '140px' : '' - } - }, [editor, webForceMinHeight]) + }, [t, fonts, webForceMinHeight]) return ( <> -- cgit 1.4.1