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]: Duplicate "entangled" collaboration cursors in Yjs fragments across parent doc & sibling subdocs #5271

Open
1 task done
ideosyncretic opened this issue Jun 26, 2024 · 1 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

Comments

@ideosyncretic
Copy link

Affected Packages

extension-collaboration-cursor, extension-collaboration, react

Version(s)

2.4.0

Bug Description

When using Liveblocks and Yjs subdocuments, TipTap collaboration cursors on fragments become duplicated (appearing in other fragments) and "entangled" (moving in tandem) across the parent Y.Doc and sibling subdocs, depending on the length of fragment content.

cursor.bug.2.screens.mp4

Browser Used

Chrome

Code Example URL

https://github.com/ideosyncretic/liveblocks-tiptap-yjs-subdocs-collabcursor

Expected Behavior

Collaboration cursor state should not sync to unrelated fragments.

Additional Context (Optional)

  • The issue persists with different Y.Doc shapes, whether the fragments are top-level types or in nested Y.Maps.
  • The attached code example is a Kanban board where the project Board is the parent Y.Doc, Lists are subdocs.
    • Screenshot 2024-06-22 at 21 54 30
  • We have only tested this with Liveblocks as Yjs provider, because other providers do not support subdocuments.

Dependency Updates

  • Yes, I've updated all my dependencies.
@ideosyncretic ideosyncretic 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 Jun 26, 2024
@github-project-automation github-project-automation bot moved this to Triage open in Tiptap Jun 26, 2024
@andrictham
Copy link

andrictham commented Jul 10, 2024

I went spelunking through the source code for extension-collaboration-cursor, and the origin of this bug seems to be y-prosemirror’s cursor plugin, which doesn’t support subdocuments, and has a broken implementation for cursorStateField.

Here is a related issue reported in that repo: yjs/y-prosemirror#86

And a stale PR which fixes it, but wasn’t yet merged: yjs/y-prosemirror#86

When this issue is resolved in y-prosemirror, then extension-collaboration-cursor needs to expose cursorStateField as an option so the user can configure it, and pass in the guid of the related subdoc.

This should then resolve the issue.

Edit: I filed a PR to y-prosemirror here: yjs/y-prosemirror#159. Once this is merged, it should be possible to update extension-collaboration-cursor to expose the cursorStateField, and anyone who uses subdocuments can use it to properly namespace cursors by their subdoc’s guid.

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
Status: Triage open
Development

No branches or pull requests

2 participants