Skip to content

Commit eca7722

Browse files
chore: always check if current page is empty in next_page?
1 parent 95cbfd9 commit eca7722

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/orb/internal/page.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Page
2424

2525
# @return [Boolean]
2626
def next_page?
27-
!pagination_metadata&.next_cursor.nil?
27+
!data.to_a.empty? && !pagination_metadata&.next_cursor.to_s.empty?
2828
end
2929

3030
# @raise [Orb::HTTP::Error]
@@ -66,8 +66,8 @@ def initialize(client:, req:, headers:, page_data:)
6666
super
6767

6868
case page_data
69-
in {data: Array | nil => data}
70-
@data = data&.map { Orb::Internal::Type::Converter.coerce(@model, _1) }
69+
in {data: Array => data}
70+
@data = data.map { Orb::Internal::Type::Converter.coerce(@model, _1) }
7171
else
7272
end
7373
case page_data

0 commit comments

Comments
 (0)