mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-13 18:53:59 +02:00
bugfix: moves EDITOR_TO_ON_CHANGE into useEffect for double useEffect call in react 18 (#5261)
This commit is contained in:
@@ -61,9 +61,9 @@ export const Slate = (props: {
|
|||||||
handleSelectorChange(editor)
|
handleSelectorChange(editor)
|
||||||
}, [onChange])
|
}, [onChange])
|
||||||
|
|
||||||
EDITOR_TO_ON_CHANGE.set(editor, onContextChange)
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
EDITOR_TO_ON_CHANGE.set(editor, onContextChange)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
EDITOR_TO_ON_CHANGE.set(editor, () => {})
|
EDITOR_TO_ON_CHANGE.set(editor, () => {})
|
||||||
unmountRef.current = true
|
unmountRef.current = true
|
||||||
|
Reference in New Issue
Block a user