-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Strange behavior offline + online editing #45
Comments
Fixed in slate-yjs 0.1.3 |
@BitPhinix I tested the demo again, the error repeats exactly the same |
Hmm weird, I'll recheck this again asap. |
This bug also occurs when you change selected mark at some part of text and refresh page. |
I took a look at this today and the root cause is the way the Let's say we have 2 clients with the same state (a paragraph with the text hello world): Client 1 performs a split_node operation inside the paragraph with offset 5 this results in the following operations:
Client 2 simultaneously performs a split_node operation inside the paragraph with offset 6 this results in the following operations:
If the clients are now synced the remove text operations will be combined and both insert node operations will be applied resulting in both the "word" and " word" text nodes to be inserted. YJs can't know that the new nodes are a result of a split_node operations. slate-collaborative has the exact same issue cudr/slate-collaborative#29. I'll try to find a solution as soon as I find the time to or just port over the solution of slate-collaborative if they manage to solve it. |
Closing this issue because this is the intended behavior. For more details refer to: https://discuss.yjs.dev/t/modeling-slate-split-node-behavior-in-yjs/283/2 |
This problem will cause PathRef to fail |
Strange behavior when editing text online and offline at the same time
![Screen Recording 2020-10-13 at 17 09 04](https://user-images.githubusercontent.com/2921716/95848308-14bb7c00-0d78-11eb-80f7-cc22cbce4494.gif)
I ran this demo https://github.com/BitPhinix/slate-yjs-example
The text was updated successfully, but these errors were encountered: