Skip to content

Commit

Permalink
This fix actually works
Browse files Browse the repository at this point in the history
  • Loading branch information
mgielda committed Oct 19, 2023
1 parent 5649b08 commit b9a094c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/components/CodeMirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,9 @@ const CodeMirror = ({ text, setText, id, name, className, shown, syncText, setSy
}, []);

useEffect(() => {
if (!collaboration.enabled) {
return;
}

const isFirstUser = ytext.toString().length == 0 && provider.awareness.getStates().size == 1 && provider.firstUser && ready;
const isFirstUser = collaboration.enabled && ytext.toString().length == 0 && provider.awareness.getStates().size == 1 && provider.firstUser && ready;

if (ytext.toString().length != 0) setText(ytext.toString());
if (ytext && ytext.toString().length != 0) setText(ytext.toString());

if (isFirstUser) {
console.log('You are the first user in this document. Initiating...');
Expand Down

0 comments on commit b9a094c

Please sign in to comment.