diff --git a/src/components/Editor.vue b/src/components/Editor.vue index 71376f664e..8be3cd2162 100644 --- a/src/components/Editor.vue +++ b/src/components/Editor.vue @@ -464,7 +464,7 @@ export default { onLoaded({ documentSource, documentState }) { if (documentState) { - applyDocumentState(this.$ydoc, documentState) + applyDocumentState(this.$ydoc, documentState, this.$providers[0]) } this.hasConnectionIssue = false diff --git a/src/helpers/yjs.js b/src/helpers/yjs.js index 4243e5750d..bc83c1e30a 100644 --- a/src/helpers/yjs.js +++ b/src/helpers/yjs.js @@ -36,8 +36,9 @@ export function getDocumentState(ydoc) { * * @param {Doc} ydoc - apply state to this doc * @param {string} documentState - base64 encoded doc state + * @param {object} origin - initiator object e.g. WebsocketProvider */ -export function applyDocumentState(ydoc, documentState) { +export function applyDocumentState(ydoc, documentState, origin) { const update = decodeArrayBuffer(documentState) - applyUpdate(ydoc, update) + applyUpdate(ydoc, update, origin) }