diff options
| author | Adam Soltys <[email protected]> | 2026-08-15 20:06:29 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-15 20:06:29 -0700 |
| commit | b6516e15ac942a43c701b2560d47ad47ed9c9680 (patch) | |
| tree | 4831753a69d26f117f0cea8ffb458caa7226e15e /src | |
| parent | ecc3fb207395122d4a4f43887ef08f28cc6d9879 (diff) | |
| download | coinosv3-b6516e15ac942a43c701b2560d47ad47ed9c9680.tar.gz coinosv3-b6516e15ac942a43c701b2560d47ad47ed9c9680.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_014tE4U5nEjGTQy8PwYqamfv
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.js | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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 {} } |
