Snapshots, Syncing, and History

Hi @diomedtmc,

snapshots allow you to “see” old states. You also recreate an older state of the document, like you are doing. This enables you to read the old state. But that also means that you “forget” all the updates that were created ever since. FYI: some methods on the Yjs types allow you to supply a “snapshot” object to read an older state without recreating a Yjs document.

If you want to revert a document to a previous state, you should calculate the diff and apply the changes manually to the latest version of the Yjs document. I.e. If the new state is “ABC”, but the old state is “AC”, that means you should delete the character B manually.

1 Like