Adding comments for Photos page's filters handling issue
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
/**
|
/**
|
||||||
* On page change
|
* On page change
|
||||||
*/
|
*/
|
||||||
navigating.subscribe((store: any) => {
|
navigating.subscribe((store: any) => {
|
||||||
if (store) {
|
if (store) {
|
||||||
$pageLoading = true
|
$pageLoading = true
|
||||||
|
|
||||||
@@ -35,8 +35,12 @@
|
|||||||
// Scroll back to top between page transitions
|
// Scroll back to top between page transitions
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// scrollToTop()
|
// scrollToTop()
|
||||||
window.scrollTo(0,0)
|
// Disable scroll when changing filters on /photos?
|
||||||
}, DURATION.PAGE_OUT)
|
if (!$page.query.get('country')) {
|
||||||
|
window.scrollTo(0,0)
|
||||||
|
}
|
||||||
|
|
||||||
|
}, DURATION.PAGE_OUT * 1.5)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,12 @@
|
|||||||
urlFiltersParams.set('country', filterCountry)
|
urlFiltersParams.set('country', filterCountry)
|
||||||
urlFiltersParams.set('sort', filterSort)
|
urlFiltersParams.set('sort', filterSort)
|
||||||
|
|
||||||
let path: string = `${$page.path}?${urlFiltersParams.toString()}`
|
let path = `${$page.path}?${urlFiltersParams.toString()}`
|
||||||
|
console.log(path)
|
||||||
|
|
||||||
|
// TODO: Load new params properly?
|
||||||
|
// 1. How to properly navigate to new page / 2. Avoid scrolling to top (from global __layout)
|
||||||
|
// Feels like it calls the url multiple times
|
||||||
goto(path, { replaceState: true, keepfocus: true, noscroll: true })
|
goto(path, { replaceState: true, keepfocus: true, noscroll: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +250,7 @@
|
|||||||
})
|
})
|
||||||
}, {
|
}, {
|
||||||
threshold: 0.3,
|
threshold: 0.3,
|
||||||
rootMargin: '0px 0px 0px'
|
rootMargin: '0px 0px 10%'
|
||||||
})
|
})
|
||||||
|
|
||||||
// Photos MutationObserver
|
// Photos MutationObserver
|
||||||
@@ -269,6 +274,7 @@
|
|||||||
|
|
||||||
// Destroy
|
// Destroy
|
||||||
return () => {
|
return () => {
|
||||||
|
// Disconnect observers
|
||||||
observerPhotos && observerPhotos.disconnect()
|
observerPhotos && observerPhotos.disconnect()
|
||||||
mutationPhotos && mutationPhotos.disconnect()
|
mutationPhotos && mutationPhotos.disconnect()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user