fix(router): avoid duplicate history entries (#1827)

pull/1833/head
Em Zhan 2 years ago committed by GitHub
parent 5d2fc3f922
commit 1553dbce8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

Loading…
Cancel
Save