mirror of
https://github.com/urbit/shrub.git
synced 2025-01-04 10:32:34 +03:00
interface: fix simultaneous requests in loading
This commit is contained in:
parent
b1b9bc01e8
commit
0a29d95cb8
@ -36,10 +36,10 @@ export function useLazyScroll(
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if((oldCount > count) && ref.current) {
|
if((oldCount > count) && ref.current && !isLoading) {
|
||||||
loadUntil(ref.current);
|
loadUntil(ref.current);
|
||||||
}
|
}
|
||||||
}, [count]);
|
}, [count, isLoading]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(!ready) {
|
if(!ready) {
|
||||||
@ -48,7 +48,7 @@ export function useLazyScroll(
|
|||||||
}, [ready]);
|
}, [ready]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ref.current || isDone || !ready) {
|
if (!ref.current || isDone || !ready || isLoading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const scroll = ref.current;
|
const scroll = ref.current;
|
||||||
@ -64,7 +64,7 @@ export function useLazyScroll(
|
|||||||
return () => {
|
return () => {
|
||||||
ref.current?.removeEventListener('scroll', onScroll);
|
ref.current?.removeEventListener('scroll', onScroll);
|
||||||
};
|
};
|
||||||
}, [ref?.current, ready, isDone]);
|
}, [ref?.current, ready, isDone, isLoading]);
|
||||||
|
|
||||||
return { isDone, isLoading };
|
return { isDone, isLoading };
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user