-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Apollo doesn't show all the data that is fetched. #8898
Comments
Have faced the similar situation while using fragments. network tab on the browser shows all the fields i've also verified with the apollo extension in the chrome. network-only : policy will yield proper responses |
I think I have the same problem with missing data with and without using fragments. Has anyone found a solution to the problem? Here is my data example. All table cells are missing in react result, see console output. API result in Chrome Network tab
Query in react component
Console output
|
Apollo creates data in the cache using various items from the response. To disable caching you just need to set
I guess the problem is when calling a query with the same typename. Apollo sees it in cache and decides to use cache instead. I didn't go through this in-depth and have no idea what is really happening. This is something that was logical at the time, and it worked. Hope it helps you. |
@M1ck0 Although It is indeed a problem with the query cache. I connected the Apollo Chrome Extension with the ApolloClient and was able to reproduce this phenomenon. As soon as I loaded the query from the cache, the "cells" were missing from the result. Currently, I have set the |
@KPeschke I am glad if I was helpful. If you find some nice solution it would be great to post it here, just in case :) |
I'm running into this in a couple of different queries. One involves a fragment, another does not. Both use The queries fetch the expected data if you run them in Explorer or check the network tab, but the Setting the fetch policy of the query to Some things I've already verified:
Did any of you guys figure this out? |
Try to remove __typename from queries. It might help, unless you tried it already |
Without the __typename I don't think caching will work? That would address my issue (like using |
@palmsey are you sure that in your response all IDs are unique? and do you have |
I came across this problem after updating apollo and was getting reasonably certain it was a problem with the library not matching the fragments correctly. Was just starting to work on a fix when I found the information on
https://www.apollographql.com/docs/react/caching/cache-configuration/#possibletypes |
The issue is indeed caused by an interface fragment, but this didn't fix it. Only |
This is caused by an apollo client cache bug relating to interface fragments - apollographql/apollo-client#8898
@hbriese without a reproduction, we cannot do anything about cases like this. As this issue is getting crowded at this point and I guess that there are people having at least three distinct problems that just show in similar ways: please create a reproduction and open a new issue for this. |
Hello, thread. I opened a new ticket describing one of the distinct problems referenced here: #11624 If you're running into missing fields when using fragments off of an interface, the above ticket is likely relevant to you and includes two work arounds. Neither is great, but it can help if this is blocking you. |
Intended outcome:
I am making a simple query to the Apollo Server on the backend. The query looks like this
Each offer is an item that has a product object. It should return an array of offers, where every offer has an id and product object with requested fields.
Actual outcome:
When I run this query it executes without triggering any errors, but the problem is that the product name is always null.
This is how I run query
When I
console.log()
response product's name is null. This wouldn't be strange if the product name was indeed null. First, we thought that it might be a problem on the backend but here is a picture that really confuses us.As you can see on the image above, every product has a name and ID in the Network tab in the Google Chrome console. The same is with Firefox and Vivaldi, but when I try to
console.log()
the data in theuseQuery
name is null.How to reproduce the issue:
I have no idea how to reproduce this. First time seeing it happen.
Versions
I also tried it on Ubuntu and Windows. Same thing.
The text was updated successfully, but these errors were encountered: