-
-
Notifications
You must be signed in to change notification settings - Fork 522
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
Using clientId
in useSubscription
after using provideApolloClients
does not work
#1494
Comments
clientId
in useSubscription
after using provideApolloCLients
does not workclientId
in useSubscription
after using provideApolloClients
does not work
I was running into the same issue. The
To fix this, in my app.vue, I manually provide the apollo clients and bind them to the app.vue
This is an addition to what the docs say about using the
Seems like the |
@twentyforty Thanks for the detailed breakdown and a possible solution. I was wondering thought, what is the This my set up in my app.js
Then inside of a component later, I use a couple of queries. One should go to the default client, and works without error:
Then in the same component I want to execute another query, this time though I want it to go to my "product" client:
This is where the error that was mentioned by @justDabuK occurs for me. Again, any help anyone can offer would be welcome. |
Found a solution to my problem. I neglected to mention that I was using Inertia in my project to serve up Vue components from the server. It has a slightly different way to set up your app in the app.js. What I had was:
It's appears that Inertia's setup in the
Again, not sure how many use Inertia, but thought I'd report back with what I had to do in order to get my set up to work. Cheers! |
Describe the bug
I have a vue project. We use the composition API. Therefore we use
provideApolloClient
in order to provide the client to all usages ofuseQuery
,useMutation
, etc. We want to use a second apollo client for a specific new subscription. Switching toprovideApolloClients
and usingclientId
as an option leads to anerror.
To Reproduce
On
App.vue
-level we do in one hookFurther down the road still on
App.Vue
level, we have subscriptions that use these clients. When I try to use a specificclientId
the error appears and the subscription does not work.In
App.vue
we first calluseProvideApolloCLients
, afterwards we start the subscriptionsLooking into the console logs, one can see that using the
clientId
always leads to anNo apolloClients injection found, tried to resolve 'otherClient' clientId
error. Even when I use"default"
asclientId
. Somehow it can not find the injected clients object.Expected behavior
I expected the above setup to work and for the subscription to use "clientB"
Versions
vue: ^3.3.4
@vue/apollo-composable: ^4.0.0-beta.1
@apollo/client: ^3.7.6
Additional context
So far I couldn't find any blog or documentation entry that actually showed how to properly use multiple clients with
apollo-composable
what you can see above is what I put my self together so far. Therefore, If you know how to properly do this or saw some blogish entry on how to do this, I'd be happy to receive a link to it.Edit:
Using no
clientId
does work and leads to no error. Therefore I think it somehow can find the injected clients when default is used by the function itself. But as described above, even when I setclientId
to "default" then it still can't find any clients.The text was updated successfully, but these errors were encountered: