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
Warning on missing data for observable query #2262
Comments
@Jay1337 I'm all for improving the development warnings / guidance of Apollo! Do you have a sample app which showcases this behavior? |
@jbaxleyiii I don't have (time to provide) a full sample app but here are some code to make the example in my first message more concrete. The schema could be:
The query observed by a React component could be:
The mutation triggered when the user adds a product to the basket could be:
Since |
@jbaxleyiii I updated to:
And now if data is missing, the partial data are passed to the wrapped component anyway ! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions to Apollo Client! |
Hey ! |
@Jay1337 sorry about that! I forgot to add the label to keep this open as an area of improvement! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions to Apollo Client! |
Hey ! |
@jbaxleyiii any update on this? Lack of any warning caused nasty bug in our application. We are using I did a little bit of debugging of Apollo and ended up with adding following code to const isLoading = isNetworkRequestInFlight(networkStatus);
if (!isLoading
&& !this.options.returnPartialData
&& partial
) {
console.warn(error);
} Logic behind this is that if there are no data being loaded it most likely means that partial data are caused by error in query. I'm not sure about I can create PR for this but I wanted to discuss it first because there's a high chance that I'm missing something. |
We're having the same issue as @msimulcik. Sometimes partial data is returned from the cache while the data is first loading. Thus, sometimes |
To help provide a more clear separation between feature requests / discussions and bugs, and to help clean up the feature request / discussion backlog, Apollo Client feature requests / discussions are now being managed under the https://github.com/apollographql/apollo-feature-requests repository. Migrated to: apollographql/apollo-feature-requests#16 |
When an observed query can't be updated because data is missing in the cache, there should be a
console.warn
because it means that:For instance, if you call a mutation to add a new product to a shopping basket with only a table of product's ids selected in the response, and if you have an observed query on the basket with product's field "weight" selected, the query won't be updated and thus the user won't see the new product.
Ideally the warning should tell which data is missing.
The text was updated successfully, but these errors were encountered: