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

When yjs clientId changed by the yjs library, the awareness crash #19

Open
ulion opened this issue Mar 14, 2022 · 3 comments
Open

When yjs clientId changed by the yjs library, the awareness crash #19

ulion opened this issue Mar 14, 2022 · 3 comments

Comments

@ulion
Copy link
Contributor

ulion commented Mar 14, 2022

I encountered crash here:
TypeError: Cannot read properties of undefined (reading 'clock')

const clock = /** @type {MetaClientState} */ (awareness.meta.get(clientID)).clock

seems right after this happened:
https://github.com/yjs/yjs/blob/9f1548204ac8a5960c3112f96de4c962bbd264e8/src/utils/Transaction.js#L334

the yjs library may change clientId, but the awareness is not ready for that.

@MaxNoetzold
Copy link

MaxNoetzold commented Jan 25, 2023

I also encounter this error regularly. I tried this simple solution:

const clientMeta= /** @type {MetaClientState} */ (awareness.meta.get(clientID))
if (!clientMeta) continue;
const clock = clientMeta.clock;

But it actually doesnt really solve the problem. The error itself is solved, but it leads to the problem that the client is out of sync afterwards.

@nightgrey
Copy link

Also have this issue in regards to https://github.com/facebook/lexical and yjs.

I'm not entirely sure about the internals of YJS; why does the client ID change happen in the first place?

@hiramhuang
Copy link

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants