From 9b4408c13c4ed0aa6e99b5342e05d57f1fccb0ee Mon Sep 17 00:00:00 2001 From: matias4205 Date: Sat, 31 Oct 2020 12:31:07 -0300 Subject: [PATCH] Fix: hasScrolled functionality --- components/core/Layout/Layout.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/core/Layout/Layout.tsx b/components/core/Layout/Layout.tsx index 9ac0a74ed..9b04181b6 100644 --- a/components/core/Layout/Layout.tsx +++ b/components/core/Layout/Layout.tsx @@ -36,14 +36,14 @@ const Layout: FC = ({ children, pageProps }) => { isDisabled: !(displaySidebar || displayModal), }) - const handleScroll = useCallback(() => { + const handleScroll = useCallback( debounce(() => { const offset = 0 const { scrollTop } = document.documentElement if (scrollTop > offset) setHasScrolled(true) else setHasScrolled(false) }, 1) - }, []) + , []) useEffect(() => { document.addEventListener('scroll', handleScroll)