Skip to content

Commit

Permalink
Return the result from useEditorEventCallback (#118)
Browse files Browse the repository at this point in the history
When we updated useEditorEventCallback to call its
callback only when EditorView was set, we
unintentionally stopped returning its result.

This change simply goes back to always returning
it.
  • Loading branch information
smoores-dev authored Aug 6, 2024
1 parent cd42372 commit 0780c61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .yarn/versions/404a2ee9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@nytimes/react-prosemirror": patch
5 changes: 4 additions & 1 deletion src/hooks/useEditorEventCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export function useEditorEventCallback<T extends unknown[], R>(

return useCallback(
(...args: T) => {
if (editorView) ref.current(editorView, ...args);
if (editorView) {
return ref.current(editorView, ...args);
}
return;
},
[editorView]
);
Expand Down

0 comments on commit 0780c61

Please sign in to comment.