When a client receives a snapshot, doc.root is replaced by the snapshot.
It is not detected by the remote change obsever, causing problems with
synchronization.
By adding snapshot event observer to document, value of the editor is
synced and the onChange handler re-setted for the replaced new root.
What this PR does / why we need it?
When a client receives a snapshot,
doc.root
is replaced by the snapshot. It is not detected by the remote change obsever, causing problems with synchronization.By adding snapshot event observer to document, value of the editor is synced and the onChange handler re-setted for the replaced new root.
Any background context you want to provide?
What are the relevant tickets?
Fixes https://github.com/yorkie-team/yorkie-js-sdk/issues/347
Checklist