Prevent triggering load more requests while loading
This commit is contained in:
@@ -291,6 +291,10 @@ export const MangaGrid: React.FC<IMangaGridProps> = (props) => {
|
|||||||
const gridHeight = entries[0].target.clientHeight;
|
const gridHeight = entries[0].target.clientHeight;
|
||||||
const isScrollbarVisible = gridHeight > document.documentElement.clientHeight;
|
const isScrollbarVisible = gridHeight > document.documentElement.clientHeight;
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!gridHeight) {
|
if (!gridHeight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -306,7 +310,7 @@ export const MangaGrid: React.FC<IMangaGridProps> = (props) => {
|
|||||||
resizeObserver.observe(gridRef.current);
|
resizeObserver.observe(gridRef.current);
|
||||||
|
|
||||||
return () => resizeObserver.disconnect();
|
return () => resizeObserver.disconnect();
|
||||||
}, [loadMore]);
|
}, [loadMore, isLoading]);
|
||||||
|
|
||||||
const hasNoItems = !isLoading && mangas.length === 0;
|
const hasNoItems = !isLoading && mangas.length === 0;
|
||||||
if (hasNoItems) {
|
if (hasNoItems) {
|
||||||
|
|||||||
Reference in New Issue
Block a user