From bda33fedca2120c22697855372b242b412e72b5c Mon Sep 17 00:00:00 2001 From: Zac Gaetano Date: Mon, 1 Jun 2026 10:59:35 +0000 Subject: [PATCH] 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 --- services/web-ui/public/app.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/web-ui/public/app.jsx b/services/web-ui/public/app.jsx index 1bcf73b..5a88667 100644 --- a/services/web-ui/public/app.jsx +++ b/services/web-ui/public/app.jsx @@ -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(() => {