From 765882eada7449ebb8d0f3e90ba3ad087c09b95b Mon Sep 17 00:00:00 2001 From: zqran Date: Tue, 13 Sep 2022 04:38:39 +0800 Subject: [PATCH] [Beta] Fix the blank page displayed when the page navigate (#5045) --- beta/src/components/SocialBanner.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beta/src/components/SocialBanner.tsx b/beta/src/components/SocialBanner.tsx index c79d4289..1ea63d2a 100644 --- a/beta/src/components/SocialBanner.tsx +++ b/beta/src/components/SocialBanner.tsx @@ -18,7 +18,7 @@ export default function SocialBanner() { if (y === 0) { // We're trying to reset scroll. // If we already scrolled past the banner, consider it as y = 0. - const bannerHeight = ref.current!.offsetHeight; // Could be zero (e.g. mobile) + const bannerHeight = ref.current?.offsetHeight ?? 0; // Could be zero (e.g. mobile) y = Math.min(window.scrollY, bannerHeight); } return realScrollTo(x, y);