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:
Alex Gleason 2024-10-28 15:37:47 +00:00
commit 07f527e28d
1 changed files with 1 additions and 1 deletions

View File

@ -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]);