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

awareness.clientID out of sync with document.clientID #850

Open
daveychu opened this issue Aug 20, 2024 · 1 comment
Open

awareness.clientID out of sync with document.clientID #850

daveychu opened this issue Aug 20, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@daveychu
Copy link

Description
If Yjs detects that another client is already using the local clientID it will generate a new one. The awareness.clientID is not updated which leads to bugs in code where they are assumed to be the same.

An example is @tiptap/extension-collaboration-cursor which uses yCursorPlugin. In https://github.com/yjs/y-prosemirror/blob/master/src/plugins/cursor-plugin.js#L86C5-L86C54 it checks the yDoc.clientID with the clientId coming from the awareness states. With the above situation, it will incorrectly detect your own awareness changes as coming from another client and you will effectively see the collaboration cursor follow your own cursor.

Steps to reproduce the bug
Steps to reproduce the behavior:

  1. Clone https://github.com/daveychu/hocuspocus/tree/client-id-out-of-sync
  2. Run npx ava tests/provider/onClientIdChanged.ts
  3. Test will fail on t.is(provider2.document.clientID, provider2.awareness.clientID)

Expected behavior
Test should succeed. awareness.clientID and document.clientID are kept in sync.

@daveychu daveychu added the bug Something isn't working label Aug 20, 2024
@dx1ded
Copy link

dx1ded commented Sep 5, 2024

+1, same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants