You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When implementing types that override the get_queryset() method as well as using relay connection, the get_queryset() method is called twice. This has the result, that when applying filters to the queryset they are applied twice. Since they are idempotent it does not change the query output, but adds unnecessary overhead.
Describe the Bug
The core of bug appears to be strawberry_django/fields/field.py:283-289 in StrawberryDjangoField:get_queryset(). When not using the relay connection the bug does not appear, but with it the if statement resolves to True
When implementing types that override the
get_queryset()
method as well as using relay connection, theget_queryset()
method is called twice. This has the result, that when applying filters to the queryset they are applied twice. Since they are idempotent it does not change the query output, but adds unnecessary overhead.Describe the Bug
The core of bug appears to be
strawberry_django/fields/field.py:283-289
inStrawberryDjangoField:get_queryset()
. When not using the relay connection the bug does not appear, but with it the if statement resolves to Trueand it is also called on the next line with
System Information
Additional Context
This behavior is reproducible in the example app. If you already have a relay app, simply add a print in the overriding get_queryset method.
Attached is the diff, applied to commit 21c14e4
bug.zip
Upvote & Fund
The text was updated successfully, but these errors were encountered: