Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(sync): send SyncStep1 right after step could not be applied
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud authored and backportbot[bot] committed Jul 1, 2025
commit e6fce89681eec6ee47e6f12c2de62d3190a9de1d
12 changes: 12 additions & 0 deletions src/services/y-websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,24 @@ messageHandlers[messageSync] = (
) => {
encoding.writeVarUint(encoder, messageSync)
const decoderForRemote = decoding.clone(decoder)
const pendingStructsBefore = provider.doc.store.pendingStructs
const syncMessageType = syncProtocol.readSyncMessage(
decoder,
encoder,
provider.doc,
provider,
)
if (
!pendingStructsBefore
&& provider.doc.store.pendingStructs
&& !encoder.hasContent
) {
// The message received left pending structs behind.
// Send SyncStep1 to resync.
console.error('Failed to integrate yjs message. Trying to resync.')
encoding.writeVarUint(encoder, messageSync)
syncProtocol.writeSyncStep1(encoder, provider.doc)
}
// Message came from the broadcast channel
// Do not track in this.remote and do not emit sync.
if (!emitSynced) {
Expand Down
Loading