fix: avoid pushing to history when clicking on the current link (#3405)

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
pull/3412/head
烽宁 9 months ago committed by GitHub
parent 1ff1534e19
commit d279e63cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -329,7 +329,7 @@ function shouldHotReload(payload: PageDataPayload): boolean {
} }
function updateHistory(href: string) { function updateHistory(href: string) {
if (inBrowser && href !== normalizeHref(location.href)) { if (inBrowser && normalizeHref(href) !== normalizeHref(location.href)) {
// save scroll position before changing url // save scroll position before changing url
history.replaceState({ scrollPosition: window.scrollY }, document.title) history.replaceState({ scrollPosition: window.scrollY }, document.title)
history.pushState(null, '', href) history.pushState(null, '', href)

Loading…
Cancel
Save