yorkie-team/yorkie

Concurrent formatting do not work

Closed this issue · 1 comments

Description:
In a situation where two clients are working simultaneously, if one applies a Text.Style operation for formatting while the other performs a Text.edit operation to insert, the results of these two operations do not converge into one.

For example:

before: The fox jumped
client A: The fox jumped
client B: The brown fox jumped
expected: The brown fox jumped or The brown fox jumped

If we start with the sentence 'The fox jumped', client A makes the entire sentence bold, and client B inserts the word 'brown' between 'The' and 'fox,' the synchronized results are not the same, as shown below:
image

The result should converge into a single status, whether it's the entire sentence 'The brown fox jumped' with bold formatting or some other form that includes bold formatting except for 'brown.'

Why:
This is because we are unable to check for concurrent cases when applying the Text.Style operation. By introducing a map called latestCreatedAtMapByActor, which is used in Text.edit or Tree.edit, we can determine the causality between the operations of the two clients.