apollo
apollo copied to clipboard
fix: composable loosing contexts during tests
trafficstars
๐ Linked issue
- https://github.com/nuxt-modules/apollo/issues/638
โ Type of change
- [ ] ๐ Documentation (updates to the documentation or readme)
- [x] ๐ Bug fix (a non-breaking change that fixes an issue)
- [ ] ๐ Enhancement (improving an existing functionality)
- [ ] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
This PR removes @vue/apollo-composable from nuxt.options.build.transpile.
Adding @vue/apollo-composable to nuxt.options.build.transpile causes all kinds of bugs since the module might be imported & executed twice.
This causes some composables (e.g. useQuery or useMutation) to loose context (currentApolloClients) in specific scenarios.
One such scenario is running vitest & @nuxt/test-utils test with useQuery or useMutation:
Apollo client with id default not found. Use an app.runWithContext() or provideApolloClient() if you are outside of a component setup.
Deploy Preview for apollo-module canceled.
| Name | Link |
|---|---|
| Latest commit | a9ebeb3a74e90ea38d95ea2955d30c6d038ea477 |
| Latest deploy log | https://app.netlify.com/sites/apollo-module/deploys/675f2b1ca816a80008a0c54c |