diff options
author | Nick Perez <nicholas.perez@tiptap.dev> | 2024-11-23 22:07:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-23 21:07:37 +0000 |
commit | fdc3f0f17ddedcdac736d2d21c65bc1ea1edbfdc (patch) | |
tree | 9d4ccb8fb244c1c62a0a40ed0e6da4060b257cc4 /src | |
parent | 0395ba3e793c16c964dd64f72a43566aa12a4d35 (diff) | |
download | voidsky-fdc3f0f17ddedcdac736d2d21c65bc1ea1edbfdc.tar.zst |
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 <dan.abramov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/view/com/composer/text-input/TextInput.web.tsx | 11 |
1 files changed, 3 insertions, 8 deletions
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 ( <> |