Skip to content

Commit

Permalink
[#53027] Use "?." instead of an "if" statement
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejWas committed Feb 16, 2024
1 parent 7c0c2f4 commit 648d031
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/CodeMirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,8 @@ const CodeMirror = ({ text, setText, id, name, className, mode, syncText, setSyn
editorRef.current = view;
setInitialized(true);

if (ycomments) {
ycomments.registerCodeMirror(view);
}

ycomments?.registerCodeMirror(view);

return () => {
if (collaboration.enabled) {
provider.disconnect();
Expand All @@ -177,9 +175,8 @@ const CodeMirror = ({ text, setText, id, name, className, mode, syncText, setSyn
setEditorText(editorRef.current, text);
}

if (ycomments) {
ycomments.updateMainCodeMirror();
}
ycomments?.updateMainCodeMirror();

}, [ready, initialized]);

useEffect(() => {
Expand Down

0 comments on commit 648d031

Please sign in to comment.