From e26e559c462289535eceb249caae4e4359fe89cf Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Mon, 19 Aug 2024 20:09:31 +0200 Subject: [PATCH] fix: resolveClient throwing too soon, fix #1557 --- packages/vue-apollo-composable/src/useApolloClient.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/vue-apollo-composable/src/useApolloClient.ts b/packages/vue-apollo-composable/src/useApolloClient.ts index 134392a1..7058c21b 100644 --- a/packages/vue-apollo-composable/src/useApolloClient.ts +++ b/packages/vue-apollo-composable/src/useApolloClient.ts @@ -23,10 +23,7 @@ function resolveDefaultClient (providedApolloClients: ClientDict | null, p } function resolveClientWithId (providedApolloClients: ClientDict | null, clientId: ClientId): NullableApolloClient { - if (!providedApolloClients) { - throw new Error(`No apolloClients injection found, tried to resolve '${clientId}' clientId`) - } - return providedApolloClients[clientId] + return providedApolloClients?.[clientId] } export function useApolloClient (clientId?: ClientId): UseApolloClientReturn {