fix: preserve active break over reload checkpoint (Closes #1394)
CI / lint (pull_request) Successful in 3m43s
CI / build-release (pull_request) Successful in 7s
CI / browser-journey (pull_request) Successful in 6m49s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy committed 2026-08-25 11:56:50 +00:00
1 parent 553a01217a
commit 978351dff2
2 files changed
+33 -3

No files matched your search

+4 -3
View File
@@ -117,16 +117,17 @@ function createTodayTimer({ storage, getLogin, now = () => Date.now(), onChange
}
if (!ledger[identity] || ledger[identity].elapsed_ms !== Math.floor(Number(elapsedMs))) return false;
const state = read();
const keepBreak = validBreak(state)?.identity === identity;
state.active_identity = identity;
state.entries = ledger;
state.entries[identity].started_at = running ? now() : null;
state.entries[identity].running = Boolean(running);
state.entries[identity].started_at = running && !keepBreak ? now() : null;
state.entries[identity].running = Boolean(running) && !keepBreak;
state.away_at = null;
state.pending_interruption = null;
state.attention_interruption = null;
state.search_interruption = null;
state.detour_interruption = null;
if(running || validBreak(state)?.identity !== identity) state.timed_break=null;
if (!keepBreak) state.timed_break = null;
return write(state);
},
activate(identity) {