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

[Bug]: Collaboration cursor flickering #5492

Closed
1 task done
tehbelinda opened this issue Aug 14, 2024 · 2 comments
Closed
1 task done

[Bug]: Collaboration cursor flickering #5492

tehbelinda opened this issue Aug 14, 2024 · 2 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@tehbelinda
Copy link

tehbelinda commented Aug 14, 2024

Affected Packages

extension-collaboration-cursor, react

Version(s)

2.6.0

Bug Description

When a user focuses on the editor in a way that makes the user's cursor visible, other users will see their cursor flickering rapidly. The behaviour is like that seen in #4482 (and potentially also #4993)

Browser Used

Chrome

Code Example URL

https://codesandbox.io/p/devbox/condescending-galileo-9djp46

(I forked the sandbox from #4482 but updated the packages to 2.6.0)

Expected Behavior

The cursor should be stable, not flickering

Additional Context (Optional)

Here is a video of it flickering:
https://github.com/user-attachments/assets/fd2ffb8c-243b-4337-9285-9f04067a736e

I tried turning off strict mode (inspired by what happened previously in #4482) and the flickering stopped

I noticed there were a bunch of editor lifecycle updates in the react package in 2.5.0+, so I reverted to 2.5.0 - confirmed the flickering still persisted. Then I tried 2.4.0, and the flickering stopped (see https://codesandbox.io/p/devbox/determined-hawking-ts6gfp).

Dependency Updates

  • Yes, I've updated all my dependencies.
@tehbelinda tehbelinda added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Aug 14, 2024
@github-project-automation github-project-automation bot moved this to Triage open in Tiptap Aug 14, 2024
nperez0111 added a commit that referenced this issue Aug 15, 2024
…5496)

The core of the change ended up being quite simple, because we can create the editor within the first render, we need to already schedule it's destruction.
Scheduling a destruction, ensures that an instance that was created in that first render pass can be cleaned up.
Waiting one more tick than before ensures that we don't accidentally destroy an editor instance that could actually be valid in the next render pass.

In StrictMode, there will be two editor instances created, the first will be created & quickly destroyed in 2 ticks.
In Normal React, there will only ever be 1 instance created and destroyed only on unmount.
@nperez0111
Copy link
Contributor

Thank you for the reproducible example, it was indeed strict mode handling again. StrictMode has weird behaviors, luckily this was not in issue in production or in normal react rendering. StrictMode should be handled correct with 2.6.4 now

@github-project-automation github-project-automation bot moved this from Triage open to Done in Tiptap Aug 15, 2024
@tehbelinda
Copy link
Author

thank you! appreciate the quick turnaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
No open projects
Archived in project
Development

No branches or pull requests

2 participants