Skip to content

Commit

Permalink
feat(pagination): avoid fetching when has_more: false (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Feb 6, 2025
1 parent df9bfaa commit 9750eb6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ export class Page<Item> extends AbstractPage<Item> implements PageResponse<Item>
return this.data ?? [];
}

override hasNextPage() {
if (this.has_more === false) {
return false;
}

return super.hasNextPage();
}

// @deprecated Please use `nextPageInfo()` instead
nextPageParams(): Partial<PageParams> | null {
const info = this.nextPageInfo();
Expand Down

0 comments on commit 9750eb6

Please sign in to comment.