diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 676f4b3c..8c783139 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -72,11 +72,11 @@ export function createRouter( } async function go(href: string = inBrowser ? location.href : '/') { - if ((await router.onBeforeRouteChange?.(href)) === false) return - href = normalizeHref(href) const loc = inBrowser ? normalizeHref(location.href) : null + if ((await router.onBeforeRouteChange?.(href)) === false) return + if (loc !== null && href !== loc) { const { pathname, hash } = new URL(href, fakeHost) const currentLoc = new URL(loc, fakeHost)