Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(nbstore): fix doc clock comparison (#10296)

EYHN8f6ce2c3b400
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);
}
}