Fixed race condition in instant loading

This commit is contained in:
squidfunk
2020-07-24 10:47:26 +02:00
parent 4e72d31043
commit 6d6811451b
8 changed files with 11 additions and 12 deletions

View File

@@ -229,7 +229,6 @@ export function setupInstantLoading(
withLatestFrom(document$)
)
.subscribe(([, { title, head }]) => {
document.dispatchEvent(new CustomEvent("DOMContentSwitch"))
document.title = title
/* Replace meta tags */
@@ -247,6 +246,9 @@ export function setupInstantLoading(
replaceElement(prev, next)
}
}
/* Finished, dispatch document switch event */
document.dispatchEvent(new CustomEvent("DOMContentSwitch"))
})
/* Debounce update of viewport offset */