What will affect the operation result stored in doc.store.clients?

hey, guys

I found something strange in my test project, i wrote some characters in my editor ( Prosemirror + Yjs) and delete some by backspace, then checked the ydoc.

the ydoc.store.clients shows the operation of that delete operation as blow:

it’s content’s str preserve the '22222" which i just deleted precisely。

if i save the doc and restore it from db, i saw that operation is as blow:

the delete struct only has information of ‘len’ rather than ‘str’,
I am wondering what lead to this change ?

1 Like

eh…it turns out that i forgot the ydoc.gc = false on my server side …

seems gc = false lead to the ds modification

now i get what the gc option of Doc means :

seems worked but still confused about how it works…

1 Like

In CRDTs you can’t delete Items, because they represent meta-data that is needed for conflict resolution. But you can delete the content of an Item, to reduce the amount of content stored. This is what gc is about. It enables some functionality to remove content while ensuring that document can always sync.

hah!~ thank you for your patience, Yjs is awesome ! :smile:

No problem. Keep an eye on my twitter feed - I will publish my first blog post about exactly this topic if you are interested.