Skip to content

Commit

Permalink
Merge pull request #4323 from nextcloud/backport/4309/stable27
Browse files Browse the repository at this point in the history
[stable27] fix: Pass origin along the initial state update
  • Loading branch information
mejo- authored Jun 20, 2023
2 parents 12f0f70 + 4208120 commit fe9c162
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 24 deletions.
4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/files-modal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/files-modal.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions js/text-editors.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-editors.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,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 fe9c162

Please sign in to comment.