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

fix: composable loosing contexts during tests #639

Open
wants to merge 1 commit into
base: v5
Choose a base branch
from

Conversation

HaNdTriX
Copy link
Contributor

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 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.

  1. Via nuxt.options.build.transpile (here)
  2. Via plugin import (here)

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.

Copy link

netlify bot commented Dec 15, 2024

βœ… Deploy Preview for apollo-module canceled.

Name Link
πŸ”¨ Latest commit a9ebeb3
πŸ” Latest deploy log https://app.netlify.com/sites/apollo-module/deploys/675f2b1ca816a80008a0c54c

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

Successfully merging this pull request may close these issues.

1 participant