.agents/memory/2026-03-03-dashboard-tab-state-persistence-fix.md

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:

  1. Modified navigation.svelte.ts to read initial tab from location.hash on module init (browser only)
  2. Updated setTab() to call history.replaceState() after state changes, updating the hash without polluting browser history
  3. Exported initNavFromHash() function that sets up a hashchange event 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.