Skip to content

Commit

Permalink
fix: Pass origin along the initial state update
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Jun 22, 2023
1 parent 5db88ed commit f953010
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/helpers/yjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit f953010

Please sign in to comment.