-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
[Example Test Case] - Some text is duplicated when two users concurrently make changes at the beginning of the same line #160
Conversation
aedd3ba
to
9e797f7
Compare
const initialContent = schema.node('doc', null, [ | ||
schema.node('paragraph', null, [schema.text('123')]), | ||
schema.node('paragraph'), | ||
schema.node('paragraph', null, [schema.text('456')]) | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example doc with a newline in the middle
const insertA = view1.state.tr.insertText('A', 6) | ||
const insertX = view2.state.tr.insertText('X', 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I insert A and X
(Attempting to simulate two different editors)
t.assert( | ||
contentAfterFirstInsert === '<paragraph>123</paragraph><paragraph>AX</paragraph><paragraph>456</paragraph>' || | ||
contentAfterFirstInsert === '<paragraph>123</paragraph><paragraph>XA</paragraph><paragraph>456</paragraph>' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things look good at this point
(The test doesn't have a preference for which order wins the tiebreak)
const insertB = view1.state.tr.insertText('B', 7) | ||
const insertY = view2.state.tr.insertText('Y', 7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another round of edits (using position 7, although there is probably a better way to do this (somewhat dependant on the earlier tiebreak?)
// TODO: This is failing. | ||
// contentAfterSecondInsert == <paragraph>123</paragraph><paragraph>ABXYX</paragraph><paragraph>456</paragraph> | ||
// Note the duplication of `X`. | ||
|
||
t.assert( | ||
contentAfterSecondInsert === '<paragraph>123</paragraph><paragraph>ABXY</paragraph><paragraph>456</paragraph>' || | ||
contentAfterSecondInsert === '<paragraph>123</paragraph><paragraph>XYAB</paragraph><paragraph>456</paragraph>' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate X
character (this test is failing)
Thank you, this PR was immensely helpful!! I fixed the issue and added a test case for it (based on your work). |
Related to the issue described here:
I've attempted to create a test case which reproduces the described issue.
CleanShot.2024-07-17.at.12.59.19.mp4
( Note that I'm not too familiar with the y.js internals, so the test may not be perfectly representative )