Using Apollo Client 3.6.9 and generated React query hooks (from codegen) I see this strange behaviour where a component uses cache as expected whenever no fetchPolicy is provide (and it's using the default "cache-first"
policy), but if I change it to have fetchPolicy "cache-and-network"
, it totally bypasses the cache when a new component is mounted. With no exception, it renders the first time with no data, and then it renders again with the data, so it's actually equivalent to just doing "network-only", which is not what I'm looking for. I've tried downgrading to other 3.x.x versions of Apollo client to see if it was a temporary glitch, but all versions act the same. Am I missing something here?
Asked
Active
Viewed 197 times
1

Knut Marius
- 1,588
- 18
- 40