Connections to doc are possible while onLoadDocument
is still in progress
#821
Labels
bug
Something isn't working
onLoadDocument
is still in progress
#821
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 ononConnect
andonSync
. 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
createDocument
this.documents.set(documentName, document)
immediately happensonLoadDocument
async hookthis.documents.has(documentName)
is true and receives an empty doc, and successfully connects to an empty doconLoadDocument
hook resolvesExpected behavior
onLoadDocument
async hookonLoadDocument
is still in progressonLoadDocument
hook resolvesThe text was updated successfully, but these errors were encountered: