apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Evict({}) not working

Open cory-mosey opened this issue 1 year ago • 1 comments

Environment

Describe the bug

Page 1: Uses the useQuery function with the 'fetch-policy' of 'cache-first' to get a list of items. For example, { id: 1, __typename: 'Item' }

Page 2: On a seperate page I have a DeleteItem mutation with an update calling evict: await deleteItem({}, { update: (cache, { data }) => { const apollo = useApollo(); apollo.clients.default.cache.evict({ id: apollo.clients.default.cache.identify({ id: 1, __typename: 'Item' }) }); apollo.clients.default.cache.gc(); } });

Expected behaviour

Expecting to see the Item removed from cache in all instances.

Reproduction

No response

Additional context

No response

Logs

No response

cory-mosey avatar Jan 16 '24 19:01 cory-mosey

Just to add 'Item' is also in a nested query.

And I'm getting a console error with: 'An error occured! For more details...' which takes me to the following page: https://www.apollographql.com/docs/react/errors/#%7B%22version%22%3A%223.8.1%22%2C%22message%22%3A12%2C%22args%22%3A%5B%5D%7D

Yet all my queries have IDs?

cory-mosey avatar Jan 16 '24 20:01 cory-mosey