[questions][ui] show load more only when more than one page

pull/531/head
Jeff Sieu 2 years ago
parent e32c7efab2
commit 4a59732281

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

Loading…
Cancel
Save