Don't download all documents when initial sync gets interrupted

This commit is contained in:
Andras Schmelczer 2025-11-27 21:52:05 +00:00
parent 476588a63b
commit c10b6435d4
2 changed files with 6 additions and 2 deletions

View file

@ -75,6 +75,10 @@ export class Database {
Math.max(0, lastSeenUpdateId ?? 0) // the first updateId will be 1 which is the first integer after -1 Math.max(0, lastSeenUpdateId ?? 0) // the first updateId will be 1 which is the first integer after -1
); );
this.documents.forEach((doc) =>
this.lastSeenUpdateIds.add(doc.metadata?.parentVersionId)
);
this.hasInitialSyncCompleted = this.hasInitialSyncCompleted =
initialState.hasInitialSyncCompleted ?? false; initialState.hasInitialSyncCompleted ?? false;
this.logger.debug( this.logger.debug(

View file

@ -28,8 +28,8 @@ export class CoveredValues {
this.advanceMinWhilePossible(); this.advanceMinWhilePossible();
} }
public add(value: number): void { public add(value: number | undefined): void {
if (value < this.minValue) { if (value === undefined || value < this.minValue) {
return; return;
} }