Browse Source

[Beta] Fix the blank page displayed when the page navigate (#5045)

main
zqran 2 years ago
committed by GitHub
parent
commit
765882eada
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beta/src/components/SocialBanner.tsx

2
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);

Loading…
Cancel
Save