refactor(sync): use FULL_STATE_OP_TYPES constant and fix comment numbering

This commit is contained in:
Johannes Millan 2026-03-05 21:02:26 +01:00
parent 755cd705f5
commit bdef26c225
2 changed files with 3 additions and 8 deletions

View file

@ -3,9 +3,9 @@ import { DBSchema, IDBPDatabase, openDB } from 'idb';
import {
Operation,
OperationLogEntry,
OpType,
VectorClock,
isFullStateOpType,
FULL_STATE_OP_TYPES,
} from '../core/operation.types';
import { StorageQuotaExceededError } from '../core/errors/sync-errors';
import { toEntityKey } from '../util/entity-key.util';
@ -1334,12 +1334,7 @@ export class OperationLogStoreService {
// Using the import's clock as the base (REPLACE) instead of the current clock (MERGE)
// prevents clock bloat that causes server-side pruning to drop the import's entry,
// which would make subsequent ops appear CONCURRENT with the import.
const fullStateOp = ops.find(
(op) =>
op.opType === OpType.SyncImport ||
op.opType === OpType.BackupImport ||
op.opType === OpType.Repair,
);
const fullStateOp = ops.find((op) => FULL_STATE_OP_TYPES.has(op.opType));
const mergedClock = fullStateOp
? { ...fullStateOp.vectorClock }

View file

@ -278,7 +278,7 @@ export class SyncHydrationService {
await this.opLogStore.setVectorClock(clockForStorage);
OpLog.normal('SyncHydrationService: Updated vector clock store after sync');
// 10. Dispatch loadAllData to update NgRx
// 11. Dispatch loadAllData to update NgRx
this.store.dispatch(loadAllData({ appDataComplete: dataToLoad }));
OpLog.normal('SyncHydrationService: Dispatched loadAllData with synced data');
} catch (e) {