Fixed instant loading jumping back to the top

This commit is contained in:
squidfunk
2023-02-10 19:43:26 +01:00
parent 329d26d34a
commit f480bb28a9
4 changed files with 7 additions and 6 deletions

View File

@@ -206,6 +206,7 @@ export function setupInstantLoading(
sample(response$)
)
.subscribe(({ url }) => {
console.log("history.pushState")
history.pushState({}, "", `${url}`)
})
@@ -288,7 +289,7 @@ export function setupInstantLoading(
sample(document$)
)
.subscribe(({ url, offset }) => {
if (url.hash && !offset) {
if (url.hash && !offset?.y) {
setLocationHash(url.hash)
} else {
window.scrollTo(0, offset?.y || 0)