Skip to content

Commit 22fd61c

Browse files
fix: Pass origin along the initial state update
Signed-off-by: Julius Härtl <[email protected]>
1 parent 0931973 commit 22fd61c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/components/Editor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ export default {
464464
465465
onLoaded({ documentSource, documentState }) {
466466
if (documentState) {
467-
applyDocumentState(this.$ydoc, documentState)
467+
applyDocumentState(this.$ydoc, documentState, this.$providers[0])
468468
}
469469
470470
this.hasConnectionIssue = false

src/helpers/yjs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ export function getDocumentState(ydoc) {
3636
*
3737
* @param {Doc} ydoc - apply state to this doc
3838
* @param {string} documentState - base64 encoded doc state
39+
* @param {object} origin - initiator object e.g. WebsocketProvider
3940
*/
40-
export function applyDocumentState(ydoc, documentState) {
41+
export function applyDocumentState(ydoc, documentState, origin) {
4142
const update = decodeArrayBuffer(documentState)
42-
applyUpdate(ydoc, update)
43+
applyUpdate(ydoc, update, origin)
4344
}

0 commit comments

Comments
 (0)