Closed matiasfha closed 5 years ago
This definitely seems strange @matiasfh - any chance you can provide a small runnable reproduction that shows this happening?
I have the same problem. It turned out that I forgot to include subfields in my client query.
Closing as no reproduction was provided in one week. Feel free to reopen if you have a minimal reproduction.
Intended outcome: The queries should be fulfilled with the requested data that is in the cache.
Actual outcome: Some queries fails to return the data from the cache with a missing data error
The use case is the follow: I'm working in offline support for an app that is currently using apollo + react. To accomplish these we decide to use the cache features of apollo along with apollo-cache-persist to save the cache store. That part of the setup works good. Now, in order to allow the app to get the data while offline I added a link, that catch the queries that are made and, if the app is offline then return the response reading from the cache to avoid hitting the network (the idea here is to add the offline support as a drop-in). To enable this, the app have a "Download data" button that perform lot of queries to retrieve the whole set of data required for offline use. All of these data then is present in the Apollo cache. Then the app goes offline and whenever a query is triggered, the link catch that and return the data that is in the cache, performing the same query but with
client. readQuery
. Here is where the issue arise. For some reason, there are certain data that is not found whenclient.readQuery
is fired up. But the data is available in the cache according the devtools. Also to be sure that the data was available. I added a client.readQuery and client.readFragment tests after the data is fetched and the data is there. The output of the issue (theclient.readQuery
is inside atry/catch
block) is: