Make the mobile Agenda addressable and Back-safe #694

Merged
timmy merged 1 commits from timmy/693-mobile-agenda-route into main 2026-08-13 00:55:20 +00:00
2 changed files with 7 additions and 6 deletions

View File

@ -6,7 +6,7 @@
'use strict'; 'use strict';
const repositoryPart = /^[A-Za-z0-9_.-]+$/; const repositoryPart = /^[A-Za-z0-9_.-]+$/;
const queueFilters = ['today', 'attention', 'update', 'later', 'draft']; const queueFilters = ['today', 'agenda', 'attention', 'update', 'later', 'draft'];
function positiveInteger(value) { function positiveInteger(value) {
const number = Number(value); const number = Number(value);

View File

@ -659,12 +659,12 @@ process.stdout.write(JSON.stringify({{calls, hash:location.hash, parsed:routes.p
def test_every_mobile_queue_route_survives_hydration_and_detail_back_navigation(): def test_every_mobile_queue_route_survives_hydration_and_detail_back_navigation():
script = f""" script = f"""
const routes = require({json.dumps(str(WORK_ROUTE))}); const routes = require({json.dumps(str(WORK_ROUTE))});
const canonical = ['today', 'attention', 'updates', 'later', 'drafts']; const canonical = ['today', 'agenda', 'attention', 'updates', 'later', 'drafts'];
const parsed = canonical.map(name => [name, routes.parse('#/my-work/' + name)]); const parsed = canonical.map(name => [name, routes.parse('#/my-work/' + name)]);
const listeners = {{}}; const listeners = {{}};
const location = {{hash:'#/my-work/later'}}; const location = {{hash:'#/my-work/agenda'}};
const calls = []; const calls = [];
const stack = ['#/my-work/later']; const stack = ['#/my-work/agenda'];
let cursor = 0; let cursor = 0;
const history = {{ const history = {{
pushState(state, _, hash) {{ stack.splice(cursor + 1); stack.push(hash); cursor += 1; location.hash = hash; }}, pushState(state, _, hash) {{ stack.splice(cursor + 1); stack.push(hash); cursor += 1; location.hash = hash; }},
@ -693,16 +693,17 @@ process.stdout.write(JSON.stringify({{parsed, calls, hash:location.hash}}));
assert json.loads(result.stdout) == { assert json.loads(result.stdout) == {
"parsed": [ "parsed": [
["today", {"kind": "queue", "filter": "today"}], ["today", {"kind": "queue", "filter": "today"}],
["agenda", {"kind": "queue", "filter": "agenda"}],
["attention", {"kind": "queue", "filter": "attention"}], ["attention", {"kind": "queue", "filter": "attention"}],
["updates", {"kind": "queue", "filter": "update"}], ["updates", {"kind": "queue", "filter": "update"}],
["later", {"kind": "queue", "filter": "later"}], ["later", {"kind": "queue", "filter": "later"}],
["drafts", {"kind": "queue", "filter": "draft"}], ["drafts", {"kind": "queue", "filter": "draft"}],
], ],
"calls": [ "calls": [
["queue", "later"], ["queue", "agenda"],
["open", 42], ["open", 42],
["close"], ["close"],
["queue", "later"], ["queue", "agenda"],
["queue", "draft"], ["queue", "draft"],
], ],
"hash": "#/my-work/drafts", "hash": "#/my-work/drafts",