Reputation: 1052
Using Apollo Client 3 and eed to remove all the results of a query regardless of the arguments. Tried like this;
cache.evict({
id: "ROOT_QUERY",
fieldName: "countries"
});
cache.gc();
However nothing removed from cache, __APOLLO_CLIENT__.cache.data
still has all the result in the cache.
I can remove a single Country object on the other hand.
You can see it here sandbox
Upvotes: 6
Views: 3658
Reputation: 1052
Simple adding broadcast: false
parameter solved the problem;
cache.evict({
id: 'ROOT_QUERY',
fieldName: 'countries',
broadcast: false,
});
cache.gc();
Upvotes: 7