From cf52e0776ef43535afed491f272c91c214830c9b Mon Sep 17 00:00:00 2001 From: Lim Chee Aun <cheeaun@gmail.com> Date: Tue, 2 Jan 2024 12:20:36 +0800 Subject: [PATCH] Don't need reachStart from useScroll --- src/pages/search.jsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pages/search.jsx b/src/pages/search.jsx index e55440ad..7c4f6ea3 100644 --- a/src/pages/search.jsx +++ b/src/pages/search.jsx @@ -17,7 +17,6 @@ import { api } from '../utils/api'; import { fetchRelationships } from '../utils/relationships'; import shortenNumber from '../utils/shorten-number'; import usePageVisibility from '../utils/usePageVisibility'; -import useScroll from '../utils/useScroll'; import useTitle from '../utils/useTitle'; const SHORT_LIMIT = 5; @@ -151,11 +150,9 @@ function Search({ columnMode, ...props }) { })(); } - const { reachStart } = useScroll({ - scrollableRef, - }); const lastHiddenTime = useRef(); usePageVisibility((visible) => { + const reachStart = scrollableRef.current?.scrollTop === 0; if (visible && reachStart) { const timeDiff = Date.now() - lastHiddenTime.current; if (!lastHiddenTime.current || timeDiff > 1000 * 3) {