mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-21 02:20:12 +00:00
Closes #7815. flushSave and flushSaveSync now compute the would-be-written raw bytes first and short-circuit when they equal lastSeenDocBytes — a typed-then- reverted cycle inside the 30s throttle window no longer produces a postMessage round-trip, an IDB transaction, or an op-log entry. The baseline is intentionally NOT updated on a skip: it already equals these bytes, so the self-echo invariant for PERSISTED_DATA_CHANGED (#7752) is preserved. Drive-by: added the isDocCorrupt guard to flushSave for symmetry with flushSaveSync / scheduleSave. The schedule gate normally prevents flushSave from firing on a corrupt doc, but corruption can be set between schedule and fire (e.g. a remote-update reload turning up an unparseable blob), so the explicit guard is cheaper than reasoning about that invariant. Persistence rename: saveContextDoc → persistContextDocRaw. The caller now owns serialisation (via serializeContextDoc) so the byte-compare can run before the persist dispatch. Three persistence.spec.ts tests replace the dropped saveContextDoc test: exact-raw write, encoder determinism (the premise the byte-compare relies on), and write-idempotence (which proves the skip loses no information). |
||
|---|---|---|
| .. | ||
| scripts | ||
| src | ||
| .gitignore | ||
| package-lock.json | ||
| package.json | ||
| tsconfig.json | ||