NerdWalletOSS / apollo-cache-policies

An extension of the Apollo 3 cache with support for advanced cache policies.
Apache License 2.0
152 stars 22 forks source link

how to verify if the response comes from the cache or from the network? #74

Open yidongw opened 11 months ago

yidongw commented 11 months ago

after creating the ApolloClient with the cache from apollo-cache-policies, I don't know how to verify if the cache ttl is actually working.

Can anyone share how to verify it?

danReynolds commented 11 months ago

Yea so you can check the networkStatus field returned in your code returned by the client fetch alongside the data response. Talks about it here: https://www.apollographql.com/docs/react/data/queries/#inspecting-loading-states