Skip to content

Commit

Permalink
feat: Expose debug function via OCA.Collectives
Browse files Browse the repository at this point in the history
Should make it easier to debug sync issues.

Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Nov 4, 2024
1 parent 01f1e3a commit a412a6e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/mixins/editorMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export default {
},
})
: null
this.setupEditorDebug()
},

updateEditorContent(markdown) {
Expand All @@ -188,5 +189,19 @@ export default {
this.hide('outline')
}
},

setupEditorDebug() {
window.OCA.Collectives.editor = this.editor.vm.$children[0]
window.OCA.Collectives.debugEditor = () => {
console.debug('ydoc clientID:', window.OCA.Collectives.editor.$ydoc.clientID)
console.debug('ydoc pendingStructs:', window.OCA.Collectives.editor.$ydoc.store.pendingStructs)
const clientVectors = []
for (const client of window.OCA.Collectives.editor.$ydoc.store.clients.values()) {
clientVectors.push(client.at(-1).id)
}
console.debug('ydoc clients vectors:', clientVectors)
console.debug('ydoc document state:', window.OCA.Collectives.editor.$syncService.getDocumentState())
}
},
},
}

0 comments on commit a412a6e

Please sign in to comment.