Skip to content

Commit d4df248

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(pagination): avoid fetching when has_more: false (#680)
1 parent 1172430 commit d4df248

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/pagination.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ export class Page<Item> extends AbstractPage<Item> implements PageResponse<Item>
4545
return this.data ?? [];
4646
}
4747

48+
override hasNextPage() {
49+
if (this.has_more === false) {
50+
return false;
51+
}
52+
53+
return super.hasNextPage();
54+
}
55+
4856
// @deprecated Please use `nextPageInfo()` instead
4957
nextPageParams(): Partial<PageParams> | null {
5058
const info = this.nextPageInfo();

0 commit comments

Comments
 (0)