-
-
Notifications
You must be signed in to change notification settings - Fork 632
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
Fragments stopped working after graphql update #994
Comments
Maybe because the version that you are using it is the only one, there is a beta version available here https://pub.dev/packages/graphql/versions/5.0.1-beta.1 can you check with it? |
@vincenzopalazzo I've just checked and 5.0.1-beta.1 also doesn't work, same behaviour |
Mh, interesting. Any tips to reproduce the error in a local env? Thanks |
@vincenzopalazzo unfortunately the API I use is private and pretty hard to reproduce since there's authorisation needed. If there's any API you know where you can use fragments in queries you can try that. |
Some app example contains fragments but I need to update them. I will put in my to-do list, but not sure that we can reproduce your error with another API. But we will see |
I am also getting null when I use fragments. Edit: mine turned out to be fixed with |
Can you provide an small example? maybe we have a bug somewhere? |
@vincenzopalazzo And thank you for your time. the library is working perfectly, except for this issue. |
@alitnk Thanks, this noCache workaround helped me as well |
If you can provide a small example will be perfect to me, and we can try to accelerate the debugging of it :) thanks |
There you go: https://github.com/alitnk/graphql_flutter_fragments_example Worth mentioning that I'm using Artemis in this example, So the query document is auto generated. |
Amazin, I will prioritize this issue in my queue to prove my gratitude to build this example. Thanks! |
The newer cache uses
Ultimately the cache shouldn't do anything to query objects without |
@vincenzopalazzo, I've worked on improving how normalize parses fragments (see latest gql-dart/ferry#300). As @micimize suggests, I expect this issue to be caused by this. In the coming versions of normalize, users will need to supply |
@asmodeoux Please try the following:
|
I'm facing the same issue I didnt have it before 5.0. possibleTypes is null for all my types. the |
Hi @msal4, another solution can be to fix the version
We are working on a solution because normalize as a breaking change in the last version, so we are deciding if we need to work with an old solution or we need to update the doc to support the new one. Sorry for that |
Hey @vincenzopalazzo, I've already added |
I'm planning on working on this this weekend. Btw,Artemis has their own client, right? So this would be the wrong repo? |
@budde377 great! |
I've created a PR outlining the steps necessary to get proper fragment resolution with the new version of normalize. @alitnk Regarding your example, as far as I can see you're not providing the @msal4 Please check the documentation to see if it makes sense. |
The new release is out https://github.com/zino-hofmann/graphql-flutter/releases/tag/v5.0.1-beta.3 |
@budde377 hey, sorry for the late response. I tried doing what you mentioned but still i couldn't get it to work unless i disable cache. I dont have any interfaces defined in my graphql schema and I already have |
@msal4, can you provide a reproducible example of this? A repo with your queries, schema, pubspec, and how you're using the client. |
@budde377 Apparently artemis generator doesn't seem to be working with graphql-flutter anymore, haven't checked why exactly but it's something related to the generated queries. I switched to graphql_codegen and everything seems to work just fine. |
We have a problem with interface fragments that might also be related to this issue. We have an interface for the user fields called Any ideas on how to solve this? |
As mentioned earlier in this thread, please try and update graphql flutter to the latest version (possibly beta), add __typename if it's not already provided by your query transformer, and supply a possibleTypes map to the client |
Describe the issue
I updated graphql package from 3.1.0 to 4.0.1 and now GraphQL responses with fragments are not operated correctly. Here is an example on StackOverflow: https://stackoverflow.com/questions/70393062/json-fails-to-parse-graphql-response-after-flutter-libs-upgrade
I'm not sure if it's related directly to graphql update or is there something wrong with parsing the response with json libraries, but I hope anyone here knows what's going wrong. I checked all the changelogs and docs and didn't find any info about that.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Old documents are working correctly and everything works as well as on 3.1.0
Actual behavior
Documents with fragments don't parse correctly anymore
device / execution context
iOS 14/15, also reproducible in Android
additional context
All the additional context is available in my StackOverflow post, please check it for code samples and screenshots
additional notes
I like everything but I hope it will work for me again :-)
The text was updated successfully, but these errors were encountered: