Hi, I have implemented Yjs on slate using the slate-yjs library, and I created a customized version of y-websocket to handle JWT authentication.
In my implementation, a Y.Doc is created on client, and information about it are sent to the server.
The server checks if the doc is in cache, otherwise it creates a server-side Y.Doc and populates it with data from an external db.
Problem is that I believe this creates a race condition, so that the empty state from the client actually overwrites the one on the server.
Correct me if I’m wrong, but I believe this is because the Y.Doc on client has been created before the one on the server.
Should I tell the server to prepare a Y.Doc before actually syncing, or is there something I’m missing?