Skip to content

Commit

Permalink
better current url comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
joetannenbaum committed Dec 3, 2024
1 parent 6752ba4 commit df094aa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ export class Router {
prefetch: true,
})

if (visit.url.href === window.location.href) {
const visitUrl = visit.url.origin + visit.url.pathname + visit.url.search
const currentUrl = window.location.origin + window.location.pathname + window.location.search

if (visitUrl === currentUrl) {
// Don't prefetch the current page, you're already on it
return
}
Expand Down

0 comments on commit df094aa

Please sign in to comment.