我尝试在GraphQL的Apollo客户端中更改addTypeName:false
apollo.create({
link: httpLinkWithErrorHandling,
cache: new InMemoryCache({ addTypename: false }),
defaultOptions: {
watchQuery: {
fetchPolicy: 'network-only',
errorPolicy: 'all'
}
}
但是它可以工作,并且会在控制台中抛出以下消息
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.
,
Could not find __typename on Fragment PopulatedOutageType
和
fragmentMatcher.js:28 DEPRECATION WARNING: using fragments without __typename is unsupported behavior and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now.
即使我将false更改为true new InMemoryCache({ addTypename: true }),
,由于突变中不需要的类型名,突变也开始失败
有什么办法可以解决这个问题