Handle browser back/forward for in-page route navigation

Listen for popstate events and reload the relation from the URL path,
so the back button correctly returns to the route_master view after
navigating to an individual route.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2026-02-27 19:21:31 +00:00
parent f6dd68ed75
commit 9b5a510d02

View file

@ -481,6 +481,11 @@ async function loadRouteMaster(relationId) {
// ── Init ───────────────────────────────────────────────────────────────────
window.addEventListener('popstate', () => {
const match = location.pathname.match(/^\/(\d+)$/);
if (match) loadRoute(parseInt(match[1], 10));
});
if (RELATION_ID) {
loadRoute(RELATION_ID);
}