Hi,
I just ran into the phenomenon that if you create 3 updates like this
- Create a new Map and set two properties, say X and Y
- Set X to a new value
- Set Y to a new value
And then apply these these updates to a new document in a changed order (1,3,2), you’ll have a transient state where the Map will be missing the Y property altogether.
This may or may not be considered an Y.js bug, but it certainly causes pain for me as an application developer - I’ll have to build defensive measures against all sorts of invalid states. I’m not familiar with the implementation details but to me this behaviour doesn’t make sense - a property is removed as a result of an update that instead should be changing the value of another property.
Is there a fix or a workaround to this issue? Except of course from “always apply your updates in order” which kinda makes sense and can mostly be implemented but in multi-client scenarios this kind of situations might still occur, right?
Here’s a Sandbox for easy reproduction: https://codesandbox.io/p/sandbox/zkgcdx