-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL errors when passing sort parameters as separate variables #571
Comments
I’ve got a failing test case set up for this - the last two items in the data provider here: kinglozzer@51c7589#diff-185c0371539557bb7be75e037e0082fd661eafa9d5a2c59ef11886da20f66f5eR782 A workaround to fix the warning is simple enough, but the original issue (sort fields coming through in the wrong order) will still be present for sort args passed in this way. I don’t think the original implementation of the fix took this method of passing sort fields into account |
I’ve just been digging into this, I’m not sure we really can fix this fully. Take this case: query ($sort: DataObjectFakeSortFields, $fileSort: FilesSimpleSortFields) {
readDataObjectFakes(sort: $sort) {
nodes {
myField
files(sort: $fileSort) {
title
}
}
}
} With these args:
Debugging the |
I’ve posted about this here, and someone has pointed out a section in the GraphQL spec which makes me think the way we currently handle sorting might be wrong. I’ll post a separate issue about that. For this issue, I think the only solution is to not try to correct the sort order if it is provided via an argument. I’ll create a PR soon |
FIX: Don't attempt to correct sort when passed as an argument (closes #571)
Module version(s) affected
4.3.5+
Description
I’ve been seeing the following warning from some projects with GraphQL, have finally decided to stop ignoring them and investigate:
from this line specifically:
https://github.com/silverstripe/silverstripe-graphql/blob/4.3.7/src/Schema/Traits/SortTrait.php#L49
I assume the code isn’t expecting a
VariableNode
instanceAppears to be a regression from #563 (
4.3.4
doesn’t produce the warning,4.3.5
and up does).I don’t fully understand the code here, so I’m not sure why this is occurring yet. I’ll try to do some more testing tomorrow.
I’ve only confirmed this against SS4 (GraphQL v4) but I suspect the same issue would apply to SS5.
How to reproduce
The best I can offer at this stage is an example of the schema:
And an example query:
Possible Solution
No response
Additional Context
No response
Validations
silverstripe/installer
(with any code examples you've provided)PRs
The text was updated successfully, but these errors were encountered: