小编Rig*_*men的帖子

如何从使突变失败的graphql响应中删除`__typename`字段

我尝试在 GraphQL 的 Apollo 客户端中更改 addTypeName: false

apollo.create({
  link: httpLinkWithErrorHandling,
  cache: new InMemoryCache({ addTypename: false }),
  defaultOptions: {
    watchQuery: {
      fetchPolicy: 'network-only',
      errorPolicy: 'all'
    }
  }
Run Code Online (Sandbox Code Playgroud)

但它可以工作,并且会在控制台中抛出以下消息

fragmentMatcher.js:26 You're using fragments in your queries, but either don't have the addTypename:true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.Please turn on the addTypename option and include __typename when writing fragments so that Apollo Clientcan accurately match fragments.
Run Code Online (Sandbox Code Playgroud)

,

Could not …
Run Code Online (Sandbox Code Playgroud)

node.js apollo graphql apollo-client express-graphql

16
推荐指数
1
解决办法
2万
查看次数