From a331ef74527a34e6de57c80c9b582d34e89a0a89 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 28 Oct 2024 10:32:44 -0500 Subject: [PATCH] Fix scroll jumping to the top? --- src/components/scroll-context.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/scroll-context.tsx b/src/components/scroll-context.tsx index ad427659f..1f74f244f 100644 --- a/src/components/scroll-context.tsx +++ b/src/components/scroll-context.tsx @@ -15,7 +15,7 @@ export const ScrollContext: React.FC = ({ 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]);