From f21fc5efd1d1da16bdc38d74bc7cd9a1634b6088 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Thu, 9 Mar 2023 21:15:39 -0800 Subject: [PATCH] fix scroll bug? --- src/pages/photogallery.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/photogallery.tsx b/src/pages/photogallery.tsx index 3fd20c5..119cbd0 100644 --- a/src/pages/photogallery.tsx +++ b/src/pages/photogallery.tsx @@ -109,8 +109,8 @@ const GalleryPage = ({ React.useEffect(() => { // hacky but it works for now requestAnimationFrame(() => { - // don't scroll into view if user got here with back button - if (!hash) { + // don't scroll into view if user got here with back button or if we just cleared it + if (!hash || !hash.length) { return; } const el = document.getElementById(hash);