From 59a791fe1f63554106cb8b5c3914f434cf96bab3 Mon Sep 17 00:00:00 2001 From: EYHN Date: Mon, 24 Feb 2025 10:22:33 +0000 Subject: [PATCH] fix(nbstore): fix doc sync logic (#10400) --- packages/common/nbstore/src/sync/doc/peer.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/common/nbstore/src/sync/doc/peer.ts b/packages/common/nbstore/src/sync/doc/peer.ts index 9cfdcb7e10f1d..fcf02f4244581 100644 --- a/packages/common/nbstore/src/sync/doc/peer.ts +++ b/packages/common/nbstore/src/sync/doc/peer.ts @@ -680,6 +680,7 @@ export class DocSyncPeer { const cachedClocks = await this.syncMetadata.getPeerRemoteClocks( this.peerId ); + this.status.remoteClocks.clear(); throwIfAborted(signal); for (const [id, v] of Object.entries(cachedClocks)) { this.status.remoteClocks.set(id, v); @@ -690,8 +691,9 @@ export class DocSyncPeer { const maxClockValue = this.status.remoteClocks.max; const newClocks = await this.remote.getDocTimestamps(maxClockValue); for (const [id, v] of Object.entries(newClocks)) { - this.actions.updateRemoteClock(id, v); + this.status.remoteClocks.set(id, v); } + this.statusUpdatedSubject$.next(true); for (const [id, v] of Object.entries(newClocks)) { await this.syncMetadata.setPeerRemoteClock(this.peerId, {