Don't need reachStart from useScroll

This commit is contained in:
Lim Chee Aun 2024-01-02 12:20:36 +08:00
parent b168707c14
commit cf52e0776e

View file

@ -17,7 +17,6 @@ import { api } from '../utils/api';
import { fetchRelationships } from '../utils/relationships'; import { fetchRelationships } from '../utils/relationships';
import shortenNumber from '../utils/shorten-number'; import shortenNumber from '../utils/shorten-number';
import usePageVisibility from '../utils/usePageVisibility'; import usePageVisibility from '../utils/usePageVisibility';
import useScroll from '../utils/useScroll';
import useTitle from '../utils/useTitle'; import useTitle from '../utils/useTitle';
const SHORT_LIMIT = 5; const SHORT_LIMIT = 5;
@ -151,11 +150,9 @@ function Search({ columnMode, ...props }) {
})(); })();
} }
const { reachStart } = useScroll({
scrollableRef,
});
const lastHiddenTime = useRef(); const lastHiddenTime = useRef();
usePageVisibility((visible) => { usePageVisibility((visible) => {
const reachStart = scrollableRef.current?.scrollTop === 0;
if (visible && reachStart) { if (visible && reachStart) {
const timeDiff = Date.now() - lastHiddenTime.current; const timeDiff = Date.now() - lastHiddenTime.current;
if (!lastHiddenTime.current || timeDiff > 1000 * 3) { if (!lastHiddenTime.current || timeDiff > 1000 * 3) {