Skip to content

Commit

Permalink
fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Jan 22, 2025
1 parent 721953c commit 50ba2e1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/client/app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 50ba2e1

Please sign in to comment.