1.2 KiB
2026-03-03 Session Notes
Dashboard Tab State Persistence Fix
Implemented persistent tab state for the Signet dashboard by syncing the active tab to location.hash. Previously, refreshing the page would always drop the user back to the config tab because navigation state was purely in-memory.
The implementation added hash-based persistence with three key changes:
- Modified
navigation.svelte.tsto read initial tab fromlocation.hashon module init (browser only) - Updated
setTab()to callhistory.replaceState()after state changes, updating the hash without polluting browser history - Exported
initNavFromHash()function that sets up ahashchangeevent listener for back/forward navigation
The solution uses replaceState instead of pushState to avoid creating history entries for tab switches—this prevents the annoying behavior of clicking through tabs then hitting back repeatedly.
Validation is handled via a VALID_TABS set containing all valid tab IDs. Invalid hashes fall back to the default config tab.
Implementation was verified with manual testing: tab state persists on refresh, direct hash navigation works, and unsaved changes warnings still fire when switching tabs.