Skip to content

Commit

Permalink
fix(nbstore): fix doc sync logic (#10400)
Browse files Browse the repository at this point in the history
  • Loading branch information
EYHN committed Feb 24, 2025
1 parent 378bb37 commit 59a791f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/common/nbstore/src/sync/doc/peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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, {
Expand Down

0 comments on commit 59a791f

Please sign in to comment.