Evict({}) not working
Environment
- Operating System: Darwin
- Node Version: v18.19.0
- Nuxt Version: 3.7.0
- CLI Version: 3.7.2
- Nitro Version: 2.8.1
- Package Manager: [email protected]
- User Config: ssr, devtools, modules, runtimeConfig, apollo
- Runtime Modules: @nuxtjs/[email protected], @nuxtjs/[email protected], [email protected], [email protected], floating-vue/nuxt
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
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?