kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 309 forks source link

fix: create default client if named client is named default #1836

Closed MiniGod closed 1 year ago

MiniGod commented 1 year ago

Checklist:

I was following the documentation about multiple clients, I encountered an error stating Client has not been defined yet.

The documentation states that if you have a named option default, it will be the default client. That does not work.

Currently, if you provide options for a default client through APOLLO_NAMED_OPTIONS, it creates a "named client" named default. Accessing it is not possible because the actual default client is not set, and using use('default') results in the default client.

This fixes that. The test added fails without the fix.