Merge branch 'scroll-pathname' into 'main'
Fix scroll jumping to the top? Closes #1770 See merge request soapbox-pub/soapbox!3197
This commit is contained in:
commit
07f527e28d
|
@ -15,7 +15,7 @@ export const ScrollContext: React.FC<IScrollContext> = ({ shouldUpdateScroll, ch
|
||||||
const prevLocation = usePrevious(location);
|
const prevLocation = usePrevious(location);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (prevLocation && shouldUpdateScroll(prevLocation, location)) {
|
if (prevLocation && (prevLocation.pathname !== location.pathname) && shouldUpdateScroll(prevLocation, location)) {
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
}, [location, shouldUpdateScroll]);
|
}, [location, shouldUpdateScroll]);
|
||||||
|
|
Loading…
Reference in New Issue