Actually we are trying to add ‘cache-control’ response header from Apollo Server, but we would like to know how does Apollo Client behave when ‘cache-control’ is present in the response headers.
My question is, will Apollo Client automatically disable the cache when this header(cache-control) is present in the response headers with a value of ‘no-store’, or do I need to set up some configuration in the Apollo Client side for not allowing the cache when cache-control is equal to ‘no-store’?
The Apollo Client cache does not have a TTL cache currently so it does not support reading the Cache-Control headers as they commonly are returned with cache-control max-age=60 to set a specific time.
If you would like to disable the cache for a particular operation you can set the fetch policy in Apollo Client: fetchPolicy: 'no-cache'
We are using Apollo Client Devtools v4.8.1 to check what data is cached. We would like to confirm that only the “Cache” tab contains cache data. As we can see there is a section within “Queries” about cache data. Please see screenshot attached.
I understood that Apollo Chrome extension says “Cache Data” under queries but it is not really cached data. Do you think would be a good idea to rename it to something else?
One last question about caching subscription, as there is no way to say on the default options object, just to confirm that we need to include ‘fetchPolicy: “no-cache”’ in all subscription.
The cache tab in the devtools should only contain cached data. I’ve confirmed this includes the Queries tab as well.
Weird that you’re seeing something in the devtools. If I open your reproduction in its own tab, the devtools show that the query was made, but there is no cache data as expected. See my screenshots.