From d279e63cb4d417420cdc3fb3e6e03c96b777289f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=83=BD=E5=AE=81?= Date: Thu, 4 Jan 2024 05:00:14 +0800 Subject: [PATCH] fix: avoid pushing to history when clicking on the current link (#3405) Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> --- src/client/app/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 02d98944..a1397018 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -329,7 +329,7 @@ function shouldHotReload(payload: PageDataPayload): boolean { } function updateHistory(href: string) { - if (inBrowser && href !== normalizeHref(location.href)) { + if (inBrowser && normalizeHref(href) !== normalizeHref(location.href)) { // save scroll position before changing url history.replaceState({ scrollPosition: window.scrollY }, document.title) history.pushState(null, '', href)