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
Bug: Unable to load any pages of the application #16
Comments
Hi! There seems to be a problem with how the package is trying to handle the variables in your graphql query. Would you mind sharing the query that is being used on the crashing page so I can investigate? |
I think it's because we use fragments. I feel like I remember reading they're not supported. Here's an example query:
Is it possible to ignore queries with fragments? |
There was actually an issue with nested inline variables. I've just published a fix in v3.0.1. As for fragments: You are right in that they are not supported by the query reduction functionality (you've read about it here at the bottom) but I've just written a unit test that demonstrates that they are safe to use. They will simply be kept in the query as is, so fields hidden behind fragments will always be requested from the server, no matter if they are present in the cache. My personal very subjective preference is to use template variables rather than fragments, which also work with query reduction, since the query will include all the fields directly. If you're still having trouble, you're very welcome to reopen the ticket or create another one! You're helping me make this package more robust by providing me with use cases that I haven't come across or thought of during development, so thanks for that. :) |
Thanks that seemed to fix the one crash, but now another crash is presenting the same outcome. The app doesn't load. It's also related to using reduced queries.
|
Yep, that was another unhandled use case of fragments in combination with variables. Wrote a test and fixed it in v3.0.2. |
Let me know if you'd prefer new tickets for reach issue. I don't mind creating new ones. Here's what's happening now. Let's say I have a query like this:
The reduced query that's generated is like this:
But this then returns a validation failure:
What I believe should be generated includes the query variables, like this:
|
The part in the query reduction implementation responsible for removing unused variables was unable to handle variables used in nested objects. Another unit test, another fix in v3.0.3. Thank you for your continued patience! |
What's happening
yarn dev
and then navigate to the URLStacktrace
The text was updated successfully, but these errors were encountered: