Can I apply update without knowing top level types?

Hello,

I receive a document update from the remote, and all I’m trying do is to reconstruct a local document from this update. If I just did following, I get an empty document.

const ylocal = new Y.Doc();
Y.applyUpdate(ylocal, receivedUpdate);

However if I did something like following, then I can reconstruct original document

const ylocal = new Y.Doc();
const map = ylocal.getMap();
Y.applyUpdate(ylocal, receivedUpdate);

This makes me wonder, if both the peers must have knowledge about the top level types contained in the shared document.

Is there a way for a peer to reconstruct document only from the update without having to know the top level types?

2 Likes