1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-12 10:14:02 +02:00

bugfix: moves EDITOR_TO_ON_CHANGE into useEffect for double useEffect call in react 18 (#5261)

This commit is contained in:
Corey Speisman
2023-01-20 00:29:36 -05:00
committed by GitHub
parent aa4e0327ee
commit 773abc01ee

View File

@@ -61,9 +61,9 @@ export const Slate = (props: {
handleSelectorChange(editor)
}, [onChange])
EDITOR_TO_ON_CHANGE.set(editor, onContextChange)
useEffect(() => {
EDITOR_TO_ON_CHANGE.set(editor, onContextChange)
return () => {
EDITOR_TO_ON_CHANGE.set(editor, () => {})
unmountRef.current = true