GraphQL错误:未提供id,但存储区已包含的id为

GraphQL错误:未提供id,但存储区已包含的id为,graphql,apollo,Graphql,Apollo,我对GraphQL和Apollo非常陌生,我不明白下面的“aliasEmail”字段有什么问题。当我把这个添加到查询中时,我得到了这个错误消息。当我将其从查询中删除时,一切都很正常。 它在“types.graphql”中定义良好,只是一个简单的字符串字段 index.js:2178 Unhandled (in react apollo:Apollo(withRouter(EmailSettingsContainer))) Error: Network error: Error writing

我对GraphQL和Apollo非常陌生,我不明白下面的“aliasEmail”字段有什么问题。当我把这个添加到查询中时,我得到了这个错误消息。当我将其从查询中删除时,一切都很正常。 它在“types.graphql”中定义良好,只是一个简单的字符串字段

index.js:2178 Unhandled (in react apollo:Apollo(withRouter(EmailSettingsContainer))) Error: Network 
error: Error writing result to store for query:
  query getCompanyForAliasEmailEditForm($companyId: ID) {
    Company(id: $companyId) {
      name
      isTaxActive
      telFixe
      aliasEmail
      telMobile
      __typename
    }
}

Store error: the application attempted to write an object with no 
provided id but the store already contains an id of 
Company:cje6xkcnxl83u01353a20p1t6 for this object. The selectionSet 
that was trying to be written is:
  Company(id: $companyId) {
    name
    isTaxActive
    telFixe
    aliasEmail
    telMobile
    __typename
  }

听起来应用程序中的其他地方已经有了另一个查询,该查询也返回公司对象,并且该查询包含
id
(或
\u id
)字段,而本例中的查询不包含该字段。Apollo使用typename和id为查询结果生成缓存键(除非使用dataIdFromObject修改此行为),因此在检测到上述差异时抛出错误。尝试在您的
getCompanyForAliasEmailEditForm
查询中包含id字段。

谢谢。我将“id”添加到查询中请求的字段中,解决了问题:-)