fix: continue Prepare Today after Attention clears (Closes #901)
CI / lint (pull_request) Successful in 1m53s
CI / build-release (pull_request) Successful in 5s
CI / browser-journey (pull_request) Successful in 56s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy committed 2026-08-15 15:25:44 +00:00
1 parent 04ae7480cf
commit c26f4bdeeb
14 files changed
+93 -30

No files matched your search

+3 -2
View File
@@ -2634,11 +2634,11 @@
});
activeMyWork = partitioned.active;
laterMyWork = partitioned.later;
const authoritativeTodayReconciliation = liveMode && hasContextSnapshot &&
const authoritativeMyWorkRefresh = liveMode && hasContextSnapshot &&
!lastContextSnapshot?.error &&
!Object.values(workPagination).some(page => page?.has_more);
todayMyWork = todayWork.reconcile(actionableMyWork, {
pruneMissing: authoritativeTodayReconciliation,
pruneMissing: authoritativeMyWorkRefresh,
onPrune: retiredIds => {
const queued = retiredIds.map(id => todaySync.enqueue('remove', id)).every(Boolean);
if (queued) todaySync.flush();
@@ -2666,6 +2666,7 @@
if (element) element.textContent = count;
});
mobileQueueCounts = counts;
mobileStartDay.reconcile({authoritative:authoritativeMyWorkRefresh});
mobileStartDay.render();
mobileTaskDock.updateQueues(counts);
mobileTaskDock.updateWork(mobileWorkEntry.mode());
+16 -6
View File
@@ -44,12 +44,12 @@
}
}
function saveCheckpoint() {
function saveCheckpoint(phase = null) {
if (!storage) return false;
const current = identity();
if (!current.login || !current.day) return false;
try {
storage.setItem(checkpointKey, JSON.stringify(current));
storage.setItem(checkpointKey, JSON.stringify({...current, phase}));
return true;
} catch (_) {
return false;
@@ -87,7 +87,7 @@
function startNext() {
const next = briefing().next;
if (reviewOrder.some(([name]) => name === next)) saveCheckpoint();
if (reviewOrder.some(([name]) => name === next)) saveCheckpoint(next);
else clearCheckpoint();
options.openQueue(next);
return next;
@@ -98,13 +98,23 @@
return {active:Boolean(checkpoint()), next:current.next, label:current.label};
}
function completePhase() {
if (!checkpoint()) return false;
function completePhase(phase) {
const saved = checkpoint();
if (!saved || (saved.phase && saved.phase !== phase)) return false;
const current = render();
saveCheckpoint();
if (options.onHandoff) options.onHandoff(current);
return true;
}
function reconcile({authoritative = false} = {}) {
const saved = checkpoint();
if (!authoritative || !saved?.phase) return false;
const counts = options.getCounts ? options.getCounts() : {};
if (count(counts[saved.phase]) > 0) return false;
return completePhase(saved.phase);
}
function finish() {
const cleared = clearCheckpoint();
render();
@@ -128,5 +138,5 @@
if (options.elements) options.elements.action.addEventListener('click', startNext);
}
return {briefing, completePhase, finish, render, start, startNext, state};
return {briefing, completePhase, finish, reconcile, render, start, startNext, state};
});
+1 -1
View File
@@ -1,7 +1,7 @@
const BASE = new URL('./', self.location.href).pathname;
importScripts(BASE + 'static/private-data-registry.js');
importScripts(BASE + 'static/background-issue-sync.js');
const CACHE = 'stackchain-dashboard-shell-v104';
const CACHE = 'stackchain-dashboard-shell-v105';
const OFFLINE_LEASE_URL = new URL(BASE + '__offline-session-lease', self.location.origin).href;
const OUTAGE_STATUSES = new Set([500, 502, 503, 504]);
const NAVIGATION_TIMEOUT_MS = self.__STACKCHAIN_NAVIGATION_TIMEOUT_MS || 4000;