ueberdosis / hocuspocus

The CRDT Yjs WebSocket backend for conflict-free real-time collaboration in your app.
https://tiptap.dev/docs/hocuspocus/introduction
MIT License
1.34k stars 128 forks source link

onLoadDocument hook called without document #847

Closed jpobley closed 3 months ago

jpobley commented 4 months ago

Description My client app will disconnect/reconnect randomly, sometimes many times during a single session. I think I've tracked the issue down to the onLoadDocument hook firing without a document, even after the client has loaded the document. When this happens, the extension I've written to load my documents from the remote store will throw an error because it can't determine a document ID without the document. I think this error is bubbling up and disconnecting the client.

I have my server and client isolated in a sandbox, so I'm certain that I only have one client attempting to connect. Does anyone have any ideas about why this is happening?

Expected behavior Consistent data in the onLoadDocument hook.

Screenshot, video, or GIF Here's a screenshot of my client's network requests during one of the sessions I described above

Screenshot 2024-07-25 at 17 21 13

Here's an example log.json file of the hook firing without a document.

Environment

jpobley commented 3 months ago

So, I tore my environment down and redeployed it, and the issue resolved itself. We'll just chalk this up to user error. Sorry for the noise 😅