-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Error in concurrent editing and styling (Edit+Style) handling #788
Comments
Case 'insert-front + style'DescriptionDuring concurrent editing and styling of a document, there is an issue where the style attribute is applied to newly inserted nodes. This behavior is unexpected and incorrect. Steps to Reproduce
0 1 2 3 4 5 6 7 8 9
<root> <p color="red"> a </p> <p color="red"> b </p> <p color="red"> c </p> </root>
<root>
<p color="red">a</p>
<p color="red">b</p>
<p color="red">c</p>
</root>
Current ResultThe results after applying and syncing local changes to each client are as follows: Client1:
<root>
<p color="red">a</p>
<p italic="true">d</p>
<p color="red">b</p>
<p color="red">c</p>
</root>
<root>
<p color="red">a</p>
<p "bold"="aa" italic="true">d</p>
<p "bold"="aa" color="red">b</p>
<p color="red">c</p>
</root> Client2:
<root>
<p color="red">a</p>
<p "bold"="aa" color="red">b</p>
<p color="red">c</p>
</root>
<root>
<p color="red">a</p>
<p italic="true">d</p>
<p "bold"="aa" color="red">b</p>
<p color="red">c</p>
</root> Suggestion1. Lamport clock comparisonIt is important to differentiate between nodes that have been newly inserted and existing nodes during the concurrent editing and styling process. This distinction will help in precisely applying style operations within the appropriate scope. By applying the rules below, all failure cases for style-related tests that occurred in the previously written tree-concurrency-test can be resolved.
err = t.traverseInPosRange(fromParent, fromLeft, toParent, toLeft,
func(token index.TreeToken[*TreeNode], _ bool) {
node := token.Node
if !node.IsRemoved() && !node.IsText() && len(attributes) > 0 {
if editedAt.After(node.ID.CreatedAt) {
return
}
// ...
}
}) Since the priority of the Lamport timestamp does not guarantee concurrent causality, this method does not solve the problem. |
Description:
What happened:
Refer to #780 , there is an error occurring in the concurrent editing and styling (Edit+Style) handling. Failure cases related to Style operation are as follows:
Edit and Style (15/84 cases)
Split and Edit (46/144 cases)
What you expected to happen:
The concurrent editing and styling (Edit+Style) should work without any errors.
How to reproduce it (as minimally and precisely as possible):
To reproduce the issue, follow the steps:
Node.CreatedAt
andeditedAt
timeTicket.Anything else we need to know?:
The error appears to be related to the violation of the commutative property.
The text was updated successfully, but these errors were encountered: