Apollo-client: Local State API method "setTypeDefs" Not Found

Created on 24 Nov 2019  路  2Comments  路  Source: apollographql/apollo-client

The "setTypeDefs" method document here is NOT located on InMemoryCache or ApolloClient instances.

Furthermore, I searched the entire install folder for "setTypeDefs" without success. Via google search, I did find it on ApolloClient class def in a pull request diff-view here in "packages/apollo-client/src/ApolloClient.ts". However, in the current version of this file it is not there.

Has it been deprecated, moved, or am I looking completely in the wrong place?

Respectfully,
MP

Most helpful comment

Want an "addTypeDefs", too. Just like "addResolvers" to deal with code split.

All 2 comments

Want an "addTypeDefs", too. Just like "addResolvers" to deal with code split.

In case someone stumbles upon this. setTypeDefs was removed in commit d3931b8347c76c961ae24da68ef108576e67ff0d on Feb 1, 2019 with the following explanation:

We're going to avoid getters/setters for typeDefs for now,
and instead recommend typeDefs are set via the ApolloClient
constructor. We were originally exposing getters/setters for
integrations like Apollo Client Devtools, but we'll adjust
devtools to access the typeDefs in a different way. We will
likely want to revisit this decision in the future, to
accommodate the possibility that people want to add to their
local schema at different points in their application, but
we'll cross that bridge when we get there. For now keeping the
changes to the public ApolloClient API minimal, is the goal.

Was this page helpful?
0 / 5 - 0 ratings