Skip to content

Commit

Permalink
fix: resolveClient throwing too soon, fix #1557 (#1570)
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Aug 19, 2024
1 parent c8e5106 commit d141ed6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/vue-apollo-composable/src/useApolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ function resolveDefaultClient<T> (providedApolloClients: ClientDict<T> | null, p
}

function resolveClientWithId<T> (providedApolloClients: ClientDict<T> | null, clientId: ClientId): NullableApolloClient<T> {
if (!providedApolloClients) {
throw new Error(`No apolloClients injection found, tried to resolve '${clientId}' clientId`)
}
return providedApolloClients[clientId]
return providedApolloClients?.[clientId]
}

export function useApolloClient<TCacheShape = any> (clientId?: ClientId): UseApolloClientReturn<TCacheShape> {
Expand Down

0 comments on commit d141ed6

Please sign in to comment.