Hi there! I’m quite new to yjs, so I might be thinking the wrong things.
I’m building a text editor and I want to be able to go back and forth between documents versions, so far I’ve done that by making a copy of the YDocument and storing it on sqlite, but I’m unsure if it is the right thing to do, I’ve seen snapshots, but I’m unsure if I need to use them or not.
It contains code snippets, links to relevant discussions, and links to example demos.
Since a Doc contains the entire version history, storing multiple copies of the entire Doc at different points in time is not the best approach. You’re better off storing the Doc once, and then storing a snapshot for each point that you would like to be able to restore.
A snapshot is just a state vector + delete set, so it takes up very little space, but it requires an existing YDoc to work.
should I store the snapshot using seperate table with the yjs storage? the yjs storage having the docs full history but the yjs will merge when the clock version greater than 500.But I need the full version of docs with versions, the version do not need so small with the yjs. like every 30 seconds generate a version. the yjs will generate version each edit action triggered will make the history version huge. I want to use a seperate table to store the version info, and generate version as rule control, I am not sure it is a good practice.