Skip to content

Commit 1ade042

Browse files
committed
fix(sync): actually disable browser broadcast
It was still enabled as we mistyped the `disableBc` option. We cannot use it right now as the y-websocket room name does not include the base version etag. Therefore different tabs may be in different sessions and would risk syncing never the less. Observed this when reloading the editor on an outdated session: * Cleaning up the old yjs document took a while in the beforeDestroy callback. * The new document was already created. * The new y-websocket provider issued a sync step 1 via browser broadcast. * The old y-websocket provider responded and send its full state. Signed-off-by: Max <[email protected]>
1 parent 34dbc9a commit 1ade042

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

src/components/Editor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ export default defineComponent({
484484
syncService: this.syncService,
485485
fileId: this.fileId,
486486
initialSession: this.initialSession,
487-
disableBC: true,
487+
disableBc: true,
488488
awareness: this.awareness,
489489
})
490490
},

src/composables/useIndexedDbProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function useIndexedDbProvider(
3939
*/
4040
function setDirty(val: boolean) {
4141
dirty.value = Boolean(val)
42-
indexedDbProvider.set('dirty', val ? 1 : 0)
42+
return indexedDbProvider.set('dirty', val ? 1 : 0)
4343
}
4444

4545
/**

src/services/SyncServiceProvider.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export default function createSyncServiceProvider({
3737
initialSession,
3838
queue,
3939
)
40-
disableBc = disableBc ?? !!window?._oc_debug
4140
const websocketProvider = new WebsocketProvider(
4241
'ws://localhost:1234',
4342
'file:' + fileId,

0 commit comments

Comments
 (0)