Don't need reachStart from useScroll
This commit is contained in:
parent
b168707c14
commit
cf52e0776e
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue