mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-17 16:37:43 +00:00
refactor(sync): use FULL_STATE_OP_TYPES constant and fix comment numbering
This commit is contained in:
parent
755cd705f5
commit
bdef26c225
2 changed files with 3 additions and 8 deletions
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue