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

Block ApolloClient devtools checks to run when using ApolloTestingModule #2072

Closed vz-tl closed 1 year ago

vz-tl commented 1 year ago

Starting with @apollo/client version 3.8.2, client dev tools checks are invoked with a setTimeout() while initializing the client, which leads to an error 1 timer(s) still in the queue. when async creating the Angular TestBed. See issue filed at https://github.com/apollographql/apollo-client/issues/11211

As Apollo developers proposal is to deactivate dev tools check in the client config options, I'm requesting to add this config to the initial setup in ApolloTestingModuleCore, as it is not possible to modify the config from the outside and it anyway just would be more logical to have this dev tools check disabled in any testing case.

 function createOptions(name: string, c?: ApolloCache<any> | null) {
      return {
        link: new ApolloLink(operation => backend.handle(addClient(name, operation))),
+      connectToDevTools: false,
        cache:
          c ||
          new InMemoryCache({
            addTypename: false,
          }),
      };
    }
PowerKiKi commented 1 year ago

It seems to make sense. I'd merge a PR for that if you submit one