Skip to content

Commit

Permalink
fix(router): avoid duplicate history entries (#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
zqianem authored Jan 21, 2023
1 parent 5d2fc3f commit 1553dbc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1553dbc

Please sign in to comment.