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

useQuery throws error if clientId supplied #620

Open
veerendrapatel opened this issue May 15, 2024 · 1 comment
Open

useQuery throws error if clientId supplied #620

veerendrapatel opened this issue May 15, 2024 · 1 comment
Labels

Comments

@veerendrapatel
Copy link

Environment

Describe the bug

I have multiple graphql client configured.
If I use useAsyncQuery supplying clientId it works
const res = await useAsyncQuery(GET_EVENT(evParam), "cmsApollo");

If I use useQuery supplying clientId I get error - Error: No apolloClients injection found, tried to resolve 'cmsApollo' clientId

const res = useQuery(
GET_EVENT(evParam),
{},
{ clientId: "cmsApollo" }
);
Error: No apolloClients injection found, tried to resolve 'cmsApollo' clientId

Expected behaviour

useQuery should work with clientId

Reproduction

No response

Additional context

No response

Logs

No response

@veerendrapatel
Copy link
Author

veerendrapatel commented May 16, 2024

@Diizzayy Both URLs point to the same GitHub repository but diff steps to configure client.
https://nuxt.com/modules/apollo
https://apollo.nuxtjs.org/getting-started/quick-start
https://github.com/Diizzayy/nuxt-graphql-client
Question: Which one is recommended for a MultiClient setup? I followed this quick start guide, and it works with "@vue/apollo-composable": "4.0.0-beta.12". While useAsyncQuery works, useQuery does not, which is discussed in this GitHub issue.
However, when I upgraded from Nuxt 3.7 to 3.11, useAsyncQuery stopped working. The following code throws an error for the supplied client ID cmsApollo:
const res = await useAsyncQuery(GET_ACCOUNT(accParam), "cmsApollo");
Please provide your input on which approach I should follow to ensure smooth future upgrades of Nuxt.

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