chore: memoize plain editor ref function
This commit is contained in:
@@ -205,7 +205,8 @@ export const PlainEditor = forwardRef<PlainEditorInterface, Props>(
|
||||
}
|
||||
}, [spellcheck, previousSpellcheck])
|
||||
|
||||
const onRef = (ref: HTMLTextAreaElement | null) => {
|
||||
const onRef = useCallback(
|
||||
(ref: HTMLTextAreaElement | null) => {
|
||||
if (tabObserverDisposer.current || !ref) {
|
||||
return
|
||||
}
|
||||
@@ -269,7 +270,9 @@ export const PlainEditor = forwardRef<PlainEditorInterface, Props>(
|
||||
observer.observe(editor.parentElement as HTMLElement, { childList: true })
|
||||
|
||||
mutationObserver.current = observer
|
||||
}
|
||||
},
|
||||
[application.keyboardService, controller],
|
||||
)
|
||||
|
||||
if (textareaUnloading) {
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user