From 0883320ccc53d8b4a31aa07cd873fecf828c149c Mon Sep 17 00:00:00 2001 From: Em Zhan Date: Fri, 20 Jan 2023 19:46:33 -0600 Subject: [PATCH] fix(router): avoid duplicate history entries --- 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 de55ab420faa..8b0972549e71 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -57,7 +57,7 @@ export function createRouter( href = url.pathname + url.search + url.hash } } - if (inBrowser) { + if (inBrowser && href !== location.href) { // save scroll position before changing url history.replaceState({ scrollPosition: window.scrollY }, document.title) history.pushState(null, '', href)