From 4231b26eea602300c3ba9d22a5de2cca5c4b91da Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Sat, 8 Apr 2023 23:52:39 -0400 Subject: [PATCH] Fix route -> page binding --- src/handbook/src/backend/events.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/handbook/src/backend/events.ts b/src/handbook/src/backend/events.ts index a05bc946b..cf132f197 100644 --- a/src/handbook/src/backend/events.ts +++ b/src/handbook/src/backend/events.ts @@ -14,6 +14,19 @@ export function setup(): void { window.onpopstate = (event) => { navigate(event.state, false); }; + + setTimeout(() => { + // Check if the window's href is a page. + const page = window.location.href.split("/").pop(); + if (page == undefined) return; + + // Convert the page to a Page type. + const pageName = page.charAt(0).toUpperCase() + page.slice(1); + const pageType = pageName as Page; + + // Navigate to the page. + navigate(pageType, false); + }, 3e2); } /**