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.19k stars 115 forks source link

Connections to doc are possible while `onLoadDocument` is still in progress #821

Closed jordangarcia closed 3 months ago

jordangarcia commented 3 months ago

Description The issue arises when multiple client connections come in for the same document, the first connection will kick off and await the onLoadDocument hook, however subsequent connections (while its still loading) incorrectly receive a connection to an empty document. When paired with @hocuspocus/provider it changes the meaning on onConnect and onSync. For the first client both of those hooks imply that the document has been loaded. For the second connection it is ambiguous if the document has been loaded.

Steps to reproduce the bug

Expected behavior