Fix the transition as it would get stuck sometimes
All checks were successful
continuous-integration/drone/push Build is passing

- Reproduction: Open two tabs, one would load, the other one would stay on the transition while the content of the page was ready and animated
This commit is contained in:
2020-04-23 11:06:41 +02:00
parent cc073b440e
commit c43b888d25
4 changed files with 50 additions and 16 deletions

View File

@@ -31,10 +31,10 @@
page.subscribe(page => {
// Show transition if page is not excluded
if (!isExcluded(previousPage) || !isExcluded(page.path)) {
// Show transition
show = false
// Reset pageReady
pageReady.set(false)
process.browser && requestAnimationFrame(() => {
show = false
})
}
// Update page for viewer navigation checking
@@ -45,14 +45,14 @@
pageReady.subscribe(loaded => {
if (loaded) {
setTimeout(() => {
// Show transition
// Hide transition
show = true
// Run the page animation
process.browser && requestAnimationFrame(animateIn)
// Change loader icon as the loader shown already
firstLoad.set(false)
// Run page animation
animateIn()
// Scroll to page top
window.scrollTo(0,0)
// Change loader as the init one shown already
firstLoad.set(false)
}, $firstLoad ? animPanelDelay : animPanelShortDelay)
}
})