-
Notifications
You must be signed in to change notification settings - Fork 52
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
Question about style conflicts #30
Comments
@gaborsar Actually the underlying CRDT remains consistent. The underlying CRDT will update based on LWW, where "last" is determined on the lamport timestamp of the operation (with the current implementation). However, I just tested this with the demo @ http://demo-ritzy.rhcloud.com/ and you're right that the editor does get out of sync, even though the underlying CRDT is correct. The editor is not getting the event notification from the CRDT data structure that something has changed, which is probably a bug in the current CRDT implementation (swarm). You can confirm that the CRDT is correct by selecting the text, and printing the CRDT to the console, and checking the attributes of the atom of interest. You'll also likely see that if you make an edit on that line, the attributes will "fix themselves" since the edit forces the editor to re-read the CRDT state. |
@rocketraman Is not the timestamp attached to the char itself? |
@gaborsar Yes, and since the attribute is attached to the char also, it inherits the timestamp. |
@rocketraman I see, but if that is true, than a format operation supposed to remove the character and insert a new that is a formatted copy of the original one? |
@gaborsar I'm working off of memory here, but you may have been right before -- the attributes are set on a char with a particular timestamp (id). Needs further investigation... replacing chars is not a good idea because we don't want a format operation to conflict with a concurrent insertion inside the formatted area. Its possible the attributes for a char should be their own CRDT. |
@rocketraman So you mean that the attributes object under the hood is a CRDT list and each formatting update appends a new updated version on the top of it? const text = [{
ID: 'U1-C1',
prev: '',
next: '',
visible: true,
value: 'x',
attributes: [{
ID: 'U1-A1',
prev: '',
next: 'U1-A2',
value: null
}, {
ID: 'U1-A2',
prev: 'U1-A1',
next: 'U1-A3',
value: {
bold: true
}
}, {
ID: 'U1-A3',
prev: 'U1-A2',
next: '',
value: {
bold: false,
italic: true
}
}]
}] |
No, I meant that it probably should be, not that it is :-) |
@rocketraman Ah OK :). I did check and the CRDT is consistent. I guess I going to check in Swarm how does it work. :) Thank you for your help! |
If it is not a big problem, I would have a small question about the CRDT of the editor: How did you solve attribute update conflicts?
Scenario:
The text was updated successfully, but these errors were encountered: