-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Open
Yjs subdocuments guids do not match after applying an update from Ycs document#3
Description
Describe the bug
Applying update from Ycs documents with subdocuments on Yjs documents generate new subdocuments guids.
To Reproduce
Steps to reproduce the behavior:
- With Ycs create a new root document.
- With Ycs create some subdocuments and add them to the root document.
- Apply update from Ycs root document to Yjs document.
For example:
// C# code
var document = new YDoc();
var subDoc1 = new YDoc(new YDocOptions(){Guid = "subdoc1"});
var subDoc2 = new YDoc(new YDocOptions(){Guid = "subdoc2"});
document.GetMap("subdocs").Set("subdoc1", subDoc1);
document.GetMap("subdocs").Set("subdoc2", subDoc2);
byte[] update = document.EncodeStateAsUpdateV2();
// send this update to Node.js (e. g. with Convert.FromBase64String())
var document = new YDoc();
var subDoc1 = new YDoc(new YDocOptions(){Guid = "subdoc1"});
var subDoc2 = new YDoc(new YDocOptions(){Guid = "subdoc2"});
document.GetMap("subdocs").Set("subdoc1", subDoc1);
document.GetMap("subdocs").Set("subdoc2", subDoc2);
byte[] update = document.EncodeStateAsUpdateV2();
// send this update to Node.js (e. g. with Convert.FromBase64String())
// JavaScript code
const document = new Y.Doc()
Y.applyUpdateV2(document, updateFromYcs)
const document = new Y.Doc()
Y.applyUpdateV2(document, updateFromYcs)
Expected behavior
Ycs subdocuments guids the same as Yjs subdocuments guids.
Screenshots
Yjs document state after applying:
Environment Information
- Node.js (v14.16.0)
- yjs (v13.4.14)
Additional context
Applying an update from a Yjs document with subdocuments to a Ycs document keeps guids as expected.
Applying an update from a Ycs document with subdocuments to the new Ycs document keeps guids as expected too.