Skip to content
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

[do not merge][lexical-yjs][lexical-playground] Chore: Add test for collaboration undo bug #6670

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mike-atticus
Copy link

@mike-atticus mike-atticus commented Sep 26, 2024

Description

Adds a test for the issue #6614 where using undo in a collaborative session results in the Lexical editor content getting out of sync with the Yjs doc, which then leads to loss of document content.

Test plan

Before

No tests to detect the bugs that lead to unexpected loss of editor content after using undo.

After

Playwright test added which uses the side-by-side collaborative playground editors to reproduce the bug after using undo.

Note that this test actually detects two separate bugs:

  1. When the left-hand side collaborator clicks undo, the action removes a character of the text typed by the right-hand side collaborator, which shouldn't happen:

image

  1. If you comment out the assertion that checks for bug 1, you'll see that the second paragraph is cleared (including RHS collaborator's text) after LHS collaborator refreshes their page.

image

Copy link

vercel bot commented Sep 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 26, 2024 4:11am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 26, 2024 4:11am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 26, 2024
Copy link

size-limit report 📦

Path Size
lexical - cjs 29.85 KB (0%)
lexical - esm 29.66 KB (0%)
@lexical/rich-text - cjs 38.3 KB (0%)
@lexical/rich-text - esm 31.55 KB (0%)
@lexical/plain-text - cjs 36.9 KB (0%)
@lexical/plain-text - esm 28.86 KB (0%)
@lexical/react - cjs 40.08 KB (0%)
@lexical/react - esm 32.91 KB (0%)

@@ -230,4 +230,92 @@ test.describe('Collaboration', () => {
focusPath: [1, 1, 0],
});
});

test('Undo with two collaborators editing same paragraph', async ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is failing on the ci :(

the failure is reproducible across different envs so i dont think its a flaky failure

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the point of this PR, to demonstrate that bug

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I created this test in case it helps others with reproducing the bug and confirming a fix, but it's not something that can be merged on its own. Let me know if I should switch this to a draft PR for now, if that's clearer for PR queue management.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see, thanks for filing a detailed issue. if its not meant to be merged, converting to draft or adding a [do not merge] to title would work

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title updated 👍

@mike-atticus mike-atticus changed the title [lexical-yjs][lexical-playground] Chore: Add test for collaboration undo bug [do not merge][lexical-yjs][lexical-playground] Chore: Add test for collaboration undo bug Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants