Using cache is important to reduce the load on APIs, and to reduce loading times, but for things that may change frequently during the runtime, it would be better to go with network-only policy.
The ShopifyConfig.fetchPolicy sets the policy for all the queries, so if you want to use cache for products and collections, you'll have to opt-in to cache-first policy for all the queries. In case of currentUser query, I think this policy is not good, as the user will update their profile from the app. Some updates can be handled locally, but others may result in inconsistent data.
To resolve this, I have hardcoded the fetchPolicy for the currentUser query, as FetchPolicy.networkOnly.
Using cache is important to reduce the load on APIs, and to reduce loading times, but for things that may change frequently during the runtime, it would be better to go with network-only policy.
The
ShopifyConfig.fetchPolicy
sets the policy for all the queries, so if you want to use cache for products and collections, you'll have to opt-in to cache-first policy for all the queries. In case ofcurrentUser
query, I think this policy is not good, as the user will update their profile from the app. Some updates can be handled locally, but others may result in inconsistent data.To resolve this, I have hardcoded the
fetchPolicy
for thecurrentUser
query, asFetchPolicy.networkOnly
.