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:
parent
f6dd68ed75
commit
9b5a510d02
1 changed files with 5 additions and 0 deletions
|
|
@ -481,6 +481,11 @@ async function loadRouteMaster(relationId) {
|
||||||
|
|
||||||
// ── Init ───────────────────────────────────────────────────────────────────
|
// ── Init ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
window.addEventListener('popstate', () => {
|
||||||
|
const match = location.pathname.match(/^\/(\d+)$/);
|
||||||
|
if (match) loadRoute(parseInt(match[1], 10));
|
||||||
|
});
|
||||||
|
|
||||||
if (RELATION_ID) {
|
if (RELATION_ID) {
|
||||||
loadRoute(RELATION_ID);
|
loadRoute(RELATION_ID);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue