Closed SupImDos closed 2 months ago
This pull request fixes a bug in the resolve_connection_from_cache
method of the ListConnectionWithTotalCount
class in the strawberry_django.relay
module. The bug was causing an AttributeError
when attempting to determine the has_next_page
value. The implementation has been updated to correctly calculate has_next_page
using the cached records.
Change | Details | Files |
---|---|---|
Fixed calculation of has_next_page in resolve_connection_from_cache method |
|
strawberry_django/relay.py |
Description
The
strawberry_django.relay.ListConnectionWithTotalCount.resolve_connection_from_cache
method currently incorrectly attempts to determinehas_next_page
from theQuerySet._result_cache
, as opposed to the cached records within it, resulting in anAttributeError
being raised.This PR ensures that
has_next_page
is determined via the last record in theQuerySet._result_cache
(if applicable), so that we don't get anAttributeError
Types of Changes
Issues Fixed or Closed by This PR
Checklist
Summary by Sourcery
Fix the calculation of
has_next_page
inresolve_connection_from_cache
to prevent anAttributeError
by using the last record in theQuerySet._result_cache
.Bug Fixes:
has_next_page
inresolve_connection_from_cache
to prevent anAttributeError
by correctly determining it from the last record in theQuerySet._result_cache
.