Merge branch 'scroll-pathname' into 'main'

Fix scroll jumping to the top?

Closes #1770

See merge request soapbox-pub/soapbox!3197
environments/review-update-vid-g70vyz/deployments/5013
Alex Gleason 2024-10-28 15:37:47 +00:00
commit 07f527e28d
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -15,7 +15,7 @@ export const ScrollContext: React.FC<IScrollContext> = ({ shouldUpdateScroll, ch
const prevLocation = usePrevious(location);
useEffect(() => {
if (prevLocation && shouldUpdateScroll(prevLocation, location)) {
if (prevLocation && (prevLocation.pathname !== location.pathname) && shouldUpdateScroll(prevLocation, location)) {
window.scrollTo(0, 0);
}
}, [location, shouldUpdateScroll]);