-
Notifications
You must be signed in to change notification settings - Fork 717
-
Notifications
You must be signed in to change notification settings - Fork 717
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
Variables Inside Fragments behaving oddly? #3324
Comments
Forgot to mention I am on Apollo iOS 1.7.1 |
Thanks for the report @vade. Yes, variables should be passed through to fragments as you would expect. Let me do some testing and see if I can reproduce this issue myself first! |
I'm not sure how there could even be a bug here that would be causing variables not to work in fragments while they are still working for arguments in the query directly. The way that GraphQL works is that the client sends the body of the GraphQL query and a list of all variables to the server. The actual usage of those variables during GraphQL execution is a back end concern. It's definitely odd that your server is returning the correct response when using GraphiQL but not Apollo iOS though. In order to get to the bottom of this, we are going to need to see what the difference in the actual HTTP requests being sent. Would you be able to debug this a bit further and show us what the HTTP request looks like? If you are unable to post log data publicly, you can strip out whatever sensitive information you need to and e-mail me the results privately at [email protected] |
Absolutely. Let me figure out the best way of handling that. Much appreciated @AnthonyMDev ! I'll try to get to this asap. |
Interesting. So one difference I note in the HTTP request to the /graphql endpoint is partially due to how the graphql console works. I can't call the query I Can state that the Apollo IOS is properly sending the variables key in the Request payload as I'd expect:
So that maybe means that there's subtle difference in our servers behavior. I may try to set up a 3rd party GQL client to validate the behavior and responses. I'll keep you updated as I discover things. Apologies ahead of time for noise, and greatly appreciate the prompt responses |
Using Hopscotch GQL Client to run the query also returns correct results from the server. So either im doing something dumb™ in my application code (entirely possible and likely) or something spookier is going on. I'll continue to update as I find out. Thanks again. |
Ok, so I will say the HTTP Request seems to be pretty differently structured between Hopsotch and our Apollo iOS client: Im leaving formatting as is, just incase its of interest Also apologies for HOPSCOTCH:
Mac App w Apollo iOS:
|
Cleaned up as JSON Hopscotch (working as expected)
Apollo iOS: (not working as expected)
|
Thanks for getting all of this data put together! As far as I can tell, Apollo is sending a properly formed GraphQL request with all of your variables intact. The differences I see between the Hopscotch and Apollo versions are:
Am I missing anything there? I'm not sure what is causing your backend not to respect the variables properly when sent via Apollo, but I would assume this is a bug with the backend, since we are sending all the information in a GraphQL spec-compliant format. The only thing I could think is that one of the variables that is being sent as |
Thanks! Yea, im wondering if there is some subtlety with the back end arguments. I actually just tried the null vs none and have variables matching, with no change. I'll continue to explore, but for now this is smelling maybe more like a my problem than your problem sort of problem :) Thank you again for the prompt responses! |
Happy to help. Hope you sort this one out! I'm going to go ahead and close the issue for now. If your investigations lead you back to thinking this is an Apollo issue, feel free to re-open this issue with new information or create a new one. Even if it's not related to Apollo, I'd be curious to hear what the problem is once you figure it out! Good luck! |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better. |
So this is totally my fault and a combination of some subtleties in my native app client decisions. Context: Im exploring some new layouts in a modern data source and compositional layout NSCollectionView. Because my searches are now also sub-searches, im sort of grouping by the relay IDs of the primary top level items. But, lo, those item ids dont change. So the internal book keeping of NSCollectionView never triggers to update the collection view items, and due to how I had wired it up, never re-draw. Once I noticed that my data source was updating, but I saw no on screen changes, it occurred that my primary hashing ID for the collection view's data source never actually changed. This is great news. Thanks for your efforts, this is all now working as expect, including the pie on my face. |
Haha, we all make those mistakes sometimes. :) Glad you've got it sorted out! |
Question
Hello
Firstly, thank you for all the work on Apollo. Seriously awesome stuff.
I'm using a feature of GQL where I have defined a query and various fragments use those query arguments.
This is similar to https://graphql.org/learn/queries/#fragments
I have validated that on my GQL Servers GraphiQL Console, the exact same query and fragments are able to function, and the 'faceted' search arguments are passed through to the fragments and results are correct.
I'm using Django with Graphene on the back end, and I am able to get correct results on the server.
Apollo iOS is able to compile my Schema, Queries and Fragments, and run the query via swift. However, it the behavior of the results seem as though the variables from the top level query are not being passed to the lower level fragments arguments.
In other words, in my query below, the server populating and generating results for
transcriptionSet
andvideosegmentSet
as expected (variables pass through).Apollo iOS appears to not be passing variables through. That diagnoses is just based on observation, im not entirely sure the best way to debug.
Question
Thank you again!
Here is my GraphGLConsole test:
The text was updated successfully, but these errors were encountered: