Hello,
I am working on a project where I need to create a custom Y.js provider. My issue is somewhat related to this other post, but distinct enough that I thought a new thread might benefit others who encounter a similar challenge in the future.
In my endeavor to build my own provider, I’ve been utilizing the function Y.applyUpdate(doc, update, this)
to apply updates received from my websocket connection. However, despite calling this function, no updates are being reflected and there are no logs or error messages to shed light on why this might be the case.
Here’s a snippet of the update I am attempting to apply:
Uint8Array(20) [1, 1, 207, 253, 224, 198, 3, 217, 41, 132, 207, 253, 224, 198, 3, 216, 41, 1, 49, 0]
After decoding the update to ascertain its correctness, it appears to be fine (I typed 1
from my browser #1):
{
"structs": [
{
"id": {
"client": 953695951,
"clock": 5337
},
"length": 1,
"origin": {
"client": 953695951,
"clock": 5336
},
"left": null,
"right": null,
"rightOrigin": null,
"parent": null,
"parentSub": null,
"redone": null,
"content": {
"str": "1"
},
"info": 2
}
],
"ds": {
"clients": {}
}
}
I am currently at an impasse and am unsure of how to debug this issue further. Is there a way to determine why an update might be “skipped” or not applied? Are there any common pitfalls or additional logging/debugging methods I should be aware of when working with Y.applyUpdate
?
I am using Yjs version 13.6.8 and testing this in Chrome 117.
Any insights or pointers would be greatly appreciated.
Thank you in advance!