From 8f6ce2c3b40006d51b04c0c11b18f2a317faeb8f Mon Sep 17 00:00:00 2001 From: EYHN Date: Thu, 20 Feb 2025 10:10:17 +0800 Subject: [PATCH] fix(nbstore): fix doc clock comparison (#10296) --- packages/common/nbstore/src/sync/doc/peer.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/common/nbstore/src/sync/doc/peer.ts b/packages/common/nbstore/src/sync/doc/peer.ts index 5caa4bd918..a12f5ddd71 100644 --- a/packages/common/nbstore/src/sync/doc/peer.ts +++ b/packages/common/nbstore/src/sync/doc/peer.ts @@ -246,7 +246,8 @@ export class DocSyncPeer { if ( !this.remote.isReadonly && clock && - (pushedClock === null || pushedClock !== clock.timestamp) + (pushedClock === null || + pushedClock.getTime() !== clock.timestamp.getTime()) ) { await this.jobs.pullAndPush(docId, signal); } else { @@ -254,7 +255,10 @@ export class DocSyncPeer { const pulled = (await this.syncMetadata.getPeerPulledRemoteClock(this.peerId, docId)) ?.timestamp ?? null; - if (pulled === null || pulled !== this.status.remoteClocks.get(docId)) { + if ( + pulled === null || + pulled.getTime() !== this.status.remoteClocks.get(docId)?.getTime() + ) { await this.jobs.pull(docId, signal); } }