Skip to content

Commit

Permalink
Fix calculation of has_next_page in resolve_connection_from_cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
SupImDos committed Sep 3, 2024
1 parent 98393a3 commit 810c045
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions strawberry_django/relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ def resolve_connection_from_cache(
for node in result
]
has_previous_page = (
nodes[0]._strawberry_row_number > 1 # type: ignore
result[0]._strawberry_row_number > 1 # type: ignore
if result
else False
)
has_next_page = (
result[-1]._strawberry_row_number < result[-1]._strawberry_total_count # type: ignore
if result
else False
)
has_next_page = result._strawberry_row_number < result if result else False

return cls(
edges=edges,
Expand Down

0 comments on commit 810c045

Please sign in to comment.