[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, 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}

Loading…
Cancel
Save