Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evict({}) not working #591

Open
cory-mosey opened this issue Jan 16, 2024 · 1 comment
Open

Evict({}) not working #591

cory-mosey opened this issue Jan 16, 2024 · 1 comment
Labels

Comments

@cory-mosey
Copy link

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: pnpm@8.14.1
  • User Config: ssr, devtools, modules, runtimeConfig, apollo
  • Runtime Modules: @nuxtjs/tailwindcss@6.8.0, @nuxtjs/apollo@5.0.0-alpha.6, nuxt-lodash@2.5.0, nuxt3-leaflet@1.0.12, 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

@cory-mosey cory-mosey added the bug label Jan 16, 2024
@cory-mosey
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant