Yjs/Prosemirror-versions demo appears to garbage collect deletions on refresh


I’ve been playing around with the y-prosemirror editor integration and attempting to implement a version history. Despite disabling garbage collection on my frontend and server, it appears that garbage collection still happens at some point after refreshing the page and fetching the ydoc, making deletions inaccessible (which greatly decreases the value of any document history)

The y-prosemirror demo itself also appears to garbage collect deletions as going to the site and viewing previous version only shows additions, and never deletions. To reproduce and see what I am talking about:

  1. Make an addition to the text at the demo site
  2. Take a snapshot
  3. delete a portion of the text
  4. take another snapshot

If you view the snapshots you made without refreshing, you’ll see the deletions. Then, if you refresh, only the additions remain accessible in the snapshot history.

Has anyone encountered this? Is anyone able to actually successfully disable garbage collection so that a snapshot history contains all deletions at all times?

I will continue to research this topic and post what I learn here in case I am able to solve the issue, but any assistance would be greatly appreciated :slight_smile:

I will add that my server is based on the y-websocket demo server but with my own custom MongoDB persistence layer. The rest of the logic, however remains the same

The problem was that our logic creates YDoc’s in multiple places on our backend (calling new Y.Doc()) and if, at each of these calls, garbage collection is not set to false, initialization will trigger garbage collection and deletions will be lost.

im having the same issue, after refreshing the deletions are gone. how do you fixed, I have gc: false

I already saw the problem, is the y-leveldb that initialize the y.doc without any options so gc is enabled