mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2026-03-30 09:01:05 +08:00
[questions][ui] show load more only when more than one page
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user