|
|
@ -9,8 +9,15 @@ export default function PaginationLoadMoreButton(
|
|
|
|
props: PaginationLoadMoreButtonProps,
|
|
|
|
props: PaginationLoadMoreButtonProps,
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
const {
|
|
|
|
const {
|
|
|
|
query: { hasNextPage, isFetchingNextPage, fetchNextPage },
|
|
|
|
query: { data, hasNextPage, isFetchingNextPage, fetchNextPage },
|
|
|
|
} = props;
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isOnlyOnePage = data?.pages.length === 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isOnlyOnePage && !hasNextPage) {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
<Button
|
|
|
|
disabled={!hasNextPage || isFetchingNextPage}
|
|
|
|
disabled={!hasNextPage || isFetchingNextPage}
|
|
|
|