Replies: 1 comment 4 replies
-
Why? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Applies to vue-apollo 3.0.0-beta.11 , Vue 2
I am currently trying to figure out how to remove an item from cache. I have a mutation which deletes an entity and along with that some referenced entities. But I noticed these entities are not removed from the cache. Therefore when rendering another component that uses the "cache-and-network" fetch policy it fetches stale entities from cache first and does some requests to fetch details for these entities, which result in errors.
So what I tried is to read the fragments from the cache (which works) and then set it to
null
or empty. But that does not remove the items from the cache. So further research on the issue led me to the conclusion, that the only way currently to manually remove these items from cache would be to usecache.evict(...)
as suggested in this question on stackoverflow or to remove the item by iterating over all items in the cache as suggested in this article but that does not seem to be at hand with vue apollo.So my question is if this problem can be solved with vue apollo in order to not having to use the fetch policy "network-only" which would take away the benefit of caching?
Beta Was this translation helpful? Give feedback.
All reactions