I’m trying to immediately remove an item from a list when the mutation is called, rather than waiting for all data to be refetched, since that can take a few seconds.
This works:
const [removeItem] = useMutation(REMOVE_ITEM, {
update: (cache, { data }) => {
cache.evict({ id: cache.identify(data.removedItem) });
cache.gc();
},
});
But this does not:
const [removeItem] = useMutation(REMOVE_ITEM, {
update: (cache, { data }) => {
cache.evict({ id: cache.identify(data.removedItem) });
cache.gc();
},
refetchQueries: "active",
});
Setting refetchQueries to any value, even []
, will break the cache eviction, so the item is not removed from the list until all data is refetched.
Is this intentional?
Thanks