apollo icon indicating copy to clipboard operation
apollo copied to clipboard

useQuery throws error if clientId supplied

Open veerendrapatel opened this issue 1 year ago • 1 comments

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 avatar May 15 '24 12:05 veerendrapatel

@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.

veerendrapatel avatar May 16 '24 16:05 veerendrapatel