Skip to content

Commit

Permalink
fix: Update monaco editor on value change only if the
Browse files Browse the repository at this point in the history
value has changed
  • Loading branch information
Gonzalo Uceda committed Nov 30, 2023
1 parent ca21758 commit 28a8088
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,12 @@ export const useEditor: UseEditor = ({
useUpdateEffect(() => {
////////////////////////////////////////////
// Update monaco editor on value change
// Only update if the value has changed
if (monaco) {
editorRef.current?.setValue(value);
const editor = editorRef.current;
if (editor.getValue() !== value) {
editorRef.current?.setValue(value);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value]);
Expand Down

0 comments on commit 28a8088

Please sign in to comment.