Over the past few years, my users have experienced random data loss; maybe 1 in 100 users or less experience it. I’m at a loss for how to even begin to investigate because the problem is so opaque, and I’m seeking advice. I don’t know the source of the issue; I don’t know if it’s my own codebase or some issue in y-prosemirror, but I figured I’d post here to brainstorm on how to debug.
Here’s what I know from witness accounts, as I have never seen the bug in the wild myself:
A user will be typing in their prosemirror document. Randomly, a paragraph or multiple paragraphs of data will simply disappear. They are not collaborating with anyone, but may have mulitiple tabs of our app open, so may be collaborating with themselves.
The transaction, or whatever deleted the data, does not go into the undo stack of the associated undo-plugin. The loss is always in discrete units of prosemirror Nodes. This has never happend to me personally.
We take periodic, exponential Y.Snapshots of the Yjs document and store the snapshots locally. One every minute for the past five minutes, one every 5 for the past 30, one every hour for the past 4, one every day for the past week, etc. The snapshots never capture the lost data; I assume because the data is not in the Yjs doc in the first place.
Oftentimes, the user will navigate away and back and paragraphs or nodes will be gone after reloading. I hesitate to mention this as navigation is so app-dependent, I feel like it confounds the issue too much. This could be two separate bugs. But, since other features in the app use Y.Array and Y.Map and the same backend, and never lose data, maybe it’s worth mentioning.
Users on Chrome, Firefox, and Safari have reported this issue, but it seems to more often be Safari users.
I have a y-websocket, y-indexeddb, and BroadcastChannel based sync system. There’s custom code that enables multiplexing multiple ydocs over one WS connection and one indexeddb database.
Features built on top of Y.Map or Y.Array never lose data. Features built with y-prosemirror/Y.XmlFragment do. I’m using y-prosemirror 1.2.12 and yjs 13.6.14.
Was there ever any version of Yjs or y-prosemirror that had issues with the prosemirror integration or Y.XmlFragment/Y.XmlElement? Has anyone ever experienced anything like this? From what I can tell, their doc changes never even make it to my WS server; it’s like they never typed at all. It seems like the changes are made in prosemirror and not communicated to the Yjs doc.