Skip to content

Commit

Permalink
Fix router bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLorantfy committed Jul 14, 2024
1 parent e32312b commit 80ef4b2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/docs-site/src/components/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 80ef4b2

Please sign in to comment.