Skip to content

[lexical-react] Bug Fix: Clear remote cursor immediately on collaborator refresh#8062

Merged
etrepum merged 3 commits intofacebook:mainfrom
aldoprogrammer:fix/collab-cursor-cleanup-8061
Jan 5, 2026
Merged

[lexical-react] Bug Fix: Clear remote cursor immediately on collaborator refresh#8062
etrepum merged 3 commits intofacebook:mainfrom
aldoprogrammer:fix/collab-cursor-cleanup-8061

Conversation

@aldoprogrammer
Copy link
Copy Markdown
Contributor

Descriptions

When a collaborator tab is refreshed or closed, their remote cursor
remains visible for several seconds due to delayed awareness cleanup.

This change clears the Yjs awareness state on page unload so the remote
cursor is removed immediately instead of waiting for a timeout.

Closes #8061

Test Plan

Before

image see that after refresh one tab, the other tab still see the previous position of cursor from the tab that we refrehed

After

image no delay cursor dissapear after one tab is refreshed.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
lexical Ready Ready Preview, Comment Jan 5, 2026 8:23pm
lexical-playground Ready Ready Preview, Comment Jan 5, 2026 8:23pm

@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Jan 4, 2026

Hi @aldoprogrammer!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla 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 Jan 4, 2026
@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Jan 4, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Jan 4, 2026
etrepum
etrepum previously approved these changes Jan 5, 2026
@etrepum etrepum dismissed their stale review January 5, 2026 20:08

Type check fails

Copy link
Copy Markdown
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

This change doesn't pass the type check, looks like there are more annotations that need updating https://github.com/facebook/lexical/actions/runs/20699932262/job/59506710070?pr=8062#step:6:60

Update the mock Client class in test utils to match the ProviderAwareness
interface. The setLocalState method now correctly accepts UserState | null
instead of just UserState, fixing the TypeScript type check error.
@aldoprogrammer
Copy link
Copy Markdown
Contributor Author

Just fixed it, it should pass now

@etrepum etrepum added this pull request to the merge queue Jan 5, 2026
Merged via the queue into facebook:main with commit 9230ba8 Jan 5, 2026
39 checks passed
@aldoprogrammer aldoprogrammer deleted the fix/collab-cursor-cleanup-8061 branch January 22, 2026 23:35
@etrepum etrepum mentioned this pull request Jan 31, 2026
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.

Bug: The cursor lags during collaborative editing.

2 participants