From b6516e15ac942a43c701b2560d47ad47ed9c9680 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 15 Aug 2026 20:06:29 -0700 Subject: The reload remembers where you stood: the pre-refresh page is captured at script load, before any boot render can pave over it Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_014tE4U5nEjGTQy8PwYqamfv --- src/app.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/app.js b/src/app.js index 091e295..0b3312d 100644 --- a/src/app.js +++ b/src/app.js @@ -528,15 +528,18 @@ function syncHistory() { } // A refresh must land where the user was — on a profile, a settings page, a -// tab — not back home. history.state survives reload, so the navigation -// snapshot the last render pushed is still there to re-apply. +// tab — not back home. history.state survives reload, but any boot-time +// render runs syncHistory and replaceStates a blank snapshot over it — so +// the pre-reload nav is captured HERE, at script load, before any render. +const BOOT_NAV = (() => { try { return (history.state && history.state.nav) || null; } catch { return null; } })(); function restoreNavFromHistory() { try { - const st = history.state; - if (!st || !st.nav || ui.screen !== 'wallet') return; - for (const f of NAV_FIELDS) if (f in st.nav) ui[f] = st.nav[f]; - navStack = [st.nav]; + const nav = BOOT_NAV; + if (!nav || ui.screen !== 'wallet') return; + for (const f of NAV_FIELDS) if (f in nav) ui[f] = nav[f]; + navStack = [nav]; navIndex = 0; + history.replaceState({ nav, i: 0 }, ''); // undo any boot-render clobber render(); } catch {} } -- cgit v1.2.3