-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
BroadcastChannel client deleting Y.Map element causes delayed deletion of element in another map. #99
Comments
Hi @lucasvanbramer, Can you please log |
They are the same and clock values are the same, even after t=2. (After t=2, the client who received the 'delete' on map2 is sometimes still receiving events for map1). |
Can you please check the value of |
For both map1 and map2 (I am observing on both), they both indicate that Perhaps an interesting detail - after the delete of |
You'll probably notice that The issue that you described can happen when you manipulate the document in Yjs' events (e.g. change a value in the observer-call). This will cause the provider to send an update via broadcastchannel. However, the event will not be sent because I'm still using If you checked that |
You're right - I did notice pendingStructs was not null, and your explanation makes perfect sense. This is a fantastic, clear explanation and was exactly what I was looking for. Thank you so much for this assistance and all the work you've put into Yjs! |
@lucasvanbramer I fixed the issue in [email protected] |
Thank you! |
@dmonad This fix unfortunately caused a regression bug wherein my project that uses yjs, y-codemirror and y-websocket suddenly started logging the following for every change/keystroke in CodeMirror:
And it looks like every keystroke creates a new client id which then messes up a bunch of other things (e.g. remote cursors, etc.). I'll try to create a repro when I have the time but just wanted to mention it here so it isn't lost. For now I'll continue using [email protected] which still works fine. |
Describe the bug
With two clients connected over a broadcastChannel to the same Doc, client1 deleting an element of map1 causes a value in map2 to be deleted on client1's side, but only after the client2 modifies the value of map2. Client1 and client2 then split and their documents do not share state. Client2 will behave normally on its side and client1 has inconsistent behavior depending on what happened in its version of map2.
To Reproduce
This issue is pretty hard to reproduce without having a GUI to emit events manually from each client at the right time. Here is the simplest possible code to illustrate the phenomenon, with comments describing what happens step by step coming from which client:
Expected behavior
At time t=2, we expect both clients one and two to receive the change to count
{action: 'update', oldValue: 0}
.Screenshots
None, but would be more than happy to share this happening live.
Environment Information
Additional context
This is happening deep within my app, but again would be happy to share any further details because this has been kind of a blocker (I can work around not having delete functionality, but it would be hacky).
The text was updated successfully, but these errors were encountered: