From 80ef4b2a9e2a7834d5e428e0e6b6cd31c013b5ad Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 14 Jul 2024 11:07:54 -0400 Subject: [PATCH] Fix router bug --- packages/docs-site/src/components/Router.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/docs-site/src/components/Router.tsx b/packages/docs-site/src/components/Router.tsx index 4a8f9dd..0142cd3 100644 --- a/packages/docs-site/src/components/Router.tsx +++ b/packages/docs-site/src/components/Router.tsx @@ -27,7 +27,12 @@ export function Router({ children }: { children: React.ReactNode }) { export function usePathname() { useContext(CounterContext); - return window.location.pathname; + const pathname = window.location.pathname; + if (pathname.endsWith("/")) { + return pathname.substring(0, pathname.length - 1); + } + + return pathname; } export function Route({