Skip to content

Commit

Permalink
Merge pull request #104 from nytimes/fix-editor-effect-destroy
Browse files Browse the repository at this point in the history
Return effect result from useEditorEffect.
  • Loading branch information
smoores-dev committed Feb 23, 2024
2 parents 2f40821 + a2f82d1 commit 124010f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .yarn/versions/00b65457.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@nytimes/react-prosemirror": patch
4 changes: 3 additions & 1 deletion src/hooks/useEditorEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export function useEditorEffect(
// be defined inline and run on every re-render.
useLayoutGroupEffect(
() => {
if (editorView) effect(editorView);
if (editorView) {
return effect(editorView);
}
},
// The rules of hooks want to be able to statically
// verify the dependencies for the effect, but this will
Expand Down

0 comments on commit 124010f

Please sign in to comment.