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 sorting by multiple fields using @strawberry_django.order, the order in which the sorting is applied (i.e. "Sort by name then age" vs "Sort by age then name") is determined by the order of the fields with in the order object (this is a different issue). This does not work if the order argument is given as a variable.
In the 2nd example above, arg.value will be a VariableNode. The fix will be to handle that case as well and in that case look info info.variable_values instead of simply bailing out.
I will try to work on a PR to fix this bug soon.
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered:
This "coerces" every object in the variables by mapping it to the matching input type. The way it does this is that it loops through the fields of the input type, building up a new dict. The resulting dict will then always have the fields in the order that they were defined in the schema and the order given by the user is lost.
I am not sure there is a way around that without making even more horrible hacks.
To me that just means that #678 is even more imporant.
When sorting by multiple fields using
@strawberry_django.order
, the order in which the sorting is applied (i.e. "Sort by name then age" vs "Sort by age then name") is determined by the order of the fields with in the order object (this is a different issue). This does not work if the order argument is given as a variable.Describe the Bug
Following schema is used:
This query will correctly sort by birthday, then name:
This will sort by name, the birthday, it will take the order as defined in the
UserOrder
class, not as given by the client:Variables:
System Information
Additional Context
The reason for this is this check:
strawberry-django/strawberry_django/ordering.py
Lines 174 to 176 in 62dc994
In the 2nd example above,
arg.value
will be aVariableNode
. The fix will be to handle that case as well and in that case look infoinfo.variable_values
instead of simply bailing out.I will try to work on a PR to fix this bug soon.
Upvote & Fund
The text was updated successfully, but these errors were encountered: