Closed bellini666 closed 2 weeks ago
This pull request addresses an issue with nested MPTT (Modified Preorder Tree Traversal) connections when trying to access the totalCount
in a GraphQL query. The changes include a fix in the resolve_connection
method in strawberry_django/relay.py
and the addition of several test files to ensure the correctness of the fix.
Files | Changes |
---|---|
tests/relay/mptt/test_nested_children.py tests/relay/mptt/test_lazy_annotations.py |
Added tests to verify the correctness of nested MPTT connections and lazy type annotations in the schema. |
tests/relay/mptt/a.py tests/relay/mptt/b.py tests/relay/mptt/models.py |
Defined models and types for MPTTAuthor and MPTTBook with necessary connections and filters. |
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 88.71%. Comparing base (
015621c
) to head (98d9c9c
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
When resolving the connection from cache, we were missing setting
nodes
in it 🤦♂️We do have a test that was passing with this, but MPTT triggered the issue. The issue was probably happening to corner cases as well
Used https://github.com/strawberry-graphql/strawberry-django/pull/551 as a base for the reproduction, but adjusted it to avoid depending on python 3.9
Fix https://github.com/strawberry-graphql/strawberry-django/issues/552