Skip to content

Commit

Permalink
bugfix: moves EDITOR_TO_ON_CHANGE into useEffect for double useEffect…
Browse files Browse the repository at this point in the history
… call in react 18
  • Loading branch information
Cspeisman committed Jan 15, 2023
1 parent d7de564 commit 7421d1d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/slate-react/src/components/slate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7421d1d

Please sign in to comment.