Skip to content

Commit

Permalink
Update RichTextEditor to update ref handle only when editor changes (#…
Browse files Browse the repository at this point in the history
…261)

* Update RichTextEditor to update ref handle only when editor changes

* Run prettier after RichTextEditor useImperativeHandle dep list fix

---------

Co-authored-by: Steven DeMartini <sjdemartini@users.noreply.github.com>
  • Loading branch information
firatoezcan and sjdemartini authored Aug 22, 2024
1 parent 95384af commit 3f41dd9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/RichTextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@ const RichTextEditor = forwardRef<RichTextEditorRef, RichTextEditorProps>(
);

// Allow consumers of this component to access the editor via ref
useImperativeHandle<RichTextEditorRef, RichTextEditorRef>(ref, () => ({
editor: editor,
}));
useImperativeHandle<RichTextEditorRef, RichTextEditorRef>(
ref,
() => ({
editor: editor,
}),
[editor]
);

// Update editable state if/when it changes
useEffect(() => {
Expand Down

0 comments on commit 3f41dd9

Please sign in to comment.