From 50ba2e109f9f4d024995da3010984590d7ac67c0 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jan 2025 01:08:19 +0530 Subject: [PATCH] fix logic --- src/client/app/router.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 8eab24bb..676f4b3c 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -72,15 +72,12 @@ export function createRouter( } async function go(href: string = inBrowser ? location.href : '/') { - href = normalizeHref(href) - let loc: string | null = null - if ((await router.onBeforeRouteChange?.(href)) === false) return - if (inBrowser) { - loc = normalizeHref(location.href) - if (href === loc) return + href = normalizeHref(href) + const loc = inBrowser ? normalizeHref(location.href) : null + if (loc !== null && href !== loc) { const { pathname, hash } = new URL(href, fakeHost) const currentLoc = new URL(loc, fakeHost)