Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable26] fix: Pass origin along the initial state update #4322

Merged
merged 2 commits into from Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Editor.vue
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
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)
}