How can I reset the cache from only one specific query, triggering its refetch?
Instead of:
store.resetStore();
Because this one trigger refetch of the entire cache.
You can "re-query" the same query again, then the cache will be updated and all the component using the cache (using the same query) will also be updated. But you need to also set the fetchPolicy
to network-only
, so it doesn't fetch the data from the cache itself.
void client.query<BasketItemCountQuery>({
query: BasketItemCountDocument,
fetchPolicy: "network-only",
});