Difference of 2 YDocs

I have 2 YDocs created from the same string using the same method and then I encoded them both to Uint8Array using Y.encodeStateAsUpdate.

Now, if I try to get the diffs of both of these docs, will it be the same? And also, how to get the diffs, I don’t see any method available to do so.

Yjs is not a diffing tool.

Think of Yjs documents as git repositories. In this analogy, a Yjs update is analogous to a git commit. If you create two git repositories with exactly the same content, you would still get a merge-conflict when you attempt to merge them. Yjs will still automatically merge, but the merge would probably result in duplication or in overwriting content. Hence, make sure that the Yjs documents that you attempt to merge have a common edit history.