fix(web-ui): sync route state with URL hash on mount + hashchange

Added useEffect to parse location.hash and update route state.
Fixes deep links like /#/library not rendering correct screen.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Zac Gaetano 2026-06-01 10:59:35 +00:00
parent 66ff7065ec
commit bda33fedca

View file

@ -23,6 +23,18 @@ function App() {
try { localStorage.setItem('df.sidebar.collapsed', next ? '1' : '0'); } catch {}
return next;
});
// Sync route state with URL hash
React.useEffect(() => {
const parseHash = () => {
const hash = window.location.hash.slice(1); // remove #
const route = hash.startsWith('/') ? hash.slice(1) : hash || 'home';
setRoute(route);
};
parseHash();
window.addEventListener('hashchange', parseHash);
return () => window.removeEventListener('hashchange', parseHash);
}, []);
}, []);
React.useEffect(() => {