feat: make Plan Today browser-back safe (#401)
CI / lint (pull_request) Successful in 44s
CI / build-release (pull_request) Successful in 5s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy committed 2026-08-09 12:39:19 +00:00
1 parent 45ceedb679
commit b9ae9c6c83
10 files changed
+87 -22

No files matched your search

+16 -8
View File
@@ -759,7 +759,11 @@
}));
}
function closePlanToday() {
function closePlanToday(navigate = true) {
if (navigate) {
taskOverlayHistory.close();
return;
}
planToday.cancel();
qs('#plan-today-sheet').hidden = true;
document.body.classList.remove('task-overlay-open');
@@ -788,12 +792,16 @@
},
});
function openPlanToday(trigger) {
function openPlanToday(trigger, navigate = true) {
if (!planningOwnerLogin) {
qs('#my-work-action-status').textContent = 'Planning is unavailable until your operator identity is restored.';
return;
}
planTodayTrigger = trigger;
if (trigger) planTodayTrigger = trigger;
if (navigate) {
taskOverlayHistory.open('plan-today');
return;
}
planToday.open(todayMyWork, activeMyWork);
qs('#plan-today-error').textContent = '';
qs('#plan-today-sheet').hidden = false;
@@ -2618,9 +2626,11 @@
mobileSearchViewport.close();
qs('#open-palette').focus();
}
if (previous === 'plan-today' && kind !== 'plan-today') closePlanToday(false);
if (kind === 'new' && previous !== 'new') openCreateIssueSheet(false);
if (kind === 'find' && previous !== 'find') openFindWorkSheet(false);
if (kind === 'search' && previous !== 'search-preview') openCommandPalette(false);
if (kind === 'plan-today' && previous !== 'plan-today') openPlanToday(planTodayTrigger, false);
},
});
taskOverlayHistory.start();
@@ -3578,15 +3588,13 @@
});
qs('#save-today-plan').addEventListener('click', () => {
const result = planToday.commit();
if (result === 'saved') closePlanToday();
if (result === 'saved') taskOverlayHistory.leave();
else qs('#plan-today-error').textContent = 'Could not save the plan on this device. Free storage and retry.';
});
qs('#save-and-start-today').addEventListener('click', () => {
const result = planToday.commit({ start:true });
if (result === 'saved') {
qs('#plan-today-sheet').hidden = true;
document.body.classList.remove('task-overlay-open');
} else qs('#plan-today-error').textContent = 'Could not save the plan on this device. Free storage and retry.';
if (result === 'saved') taskOverlayHistory.leave();
else qs('#plan-today-error').textContent = 'Could not save the plan on this device. Free storage and retry.';
});
qs('#start-work-session').addEventListener('click', () => {
const sessionItems = selectedWorkFilter === 'today' ? todayMyWork : filterMyWork(lastMyWork, selectedWorkFilter);
+1 -1
View File
@@ -1,6 +1,6 @@
const BASE = new URL('./', self.location.href).pathname;
importScripts(BASE + 'static/background-issue-sync.js');
const CACHE = 'stackchain-dashboard-shell-v62';
const CACHE = 'stackchain-dashboard-shell-v63';
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;
+1 -1
View File
@@ -5,7 +5,7 @@
})(typeof globalThis !== 'undefined' ? globalThis : this, function () {
'use strict';
const allowed = new Set(['new', 'find', 'search', 'search-preview']);
const allowed = new Set(['new', 'find', 'search', 'search-preview', 'plan-today']);
return function createTaskOverlayHistory({ history, eventTarget, onChange }) {
let active = allowed.has(history.state?.taskOverlay) ? history.state.taskOverlay : null;