Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only emit "load" when sync is set to true #587

Merged
merged 1 commit into from Nov 20, 2023
Merged

Conversation

SamyPesse
Copy link
Contributor

This PR fixes an issue when we use doc.emit('sync', [false]), at the moment, it'll emit load and change isLoaded to true.

In our case, we call doc.emit('sync', [false]) when our socket connection is dropped; and sometimes it can happen before the first time we called doc.emit('sync', [true]).

The alternative to this PR is to change the logic of the sync event to not accept an argument and to behave like the load event where calling it always set the state to true.

The workaround at the moment is to make sure to wrap doc.emit('sync', [false]) with if (doc.isSynced) { }.

@dmonad
Copy link
Member

dmonad commented Nov 20, 2023

Sorry for the long wait! I merged it and will make a release soon!

@dmonad dmonad merged commit 5861876 into yjs:main Nov 20, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants