我正在使用GitHub Graphql API并且我使用react-apollo编写了以下代码,但是当我在许多请求后分页时,我在控制台上出现以下错误 .

您正在使用简单(启发式)片段匹配器,但您的查询包含联合或接口类型 . Apollo客户端将无法准确映射片段 . 要消除此错误,请使用文档中描述的IntrospectionFragmentMatcher:https://www.apollographql.com/docs/react/recipes/fragment-matching.html

.

警告:启发式片段匹配正在进行中!

.

{“__typename”中缺少字段名称:“组织”} {“__typename”中缺少字段avatarUrl:“组织”} {“__typename”中缺少字段存储库:“组织”}

我写了以下代码:

gql`
  query($username: String!, $nextPage: String) {
    search(query: $username, type: USER, first: 100, after: $nextPage) {
      pageInfo {
        hasNextPage
        endCursor
      }
      edges {
        node {
          ... on User {
            name
            avatarUrl
            repositories {
              totalCount
            }
          }
        }
      }
    }
  }
`;


handleSubmit = ({ username }) => {
    const { client } = this.props;
    this.setState({
      loading: true,
      searchTerm: username,
    });
    client
      .query({
        query: SEARCH_USER,
        variables: {
          username
        }
      })
      .then(({ data }) => {
        this.setState({
          loading: false,
          searchList: data.search.edges,
          pagination: data.search.pageInfo,
        });
      })
      .catch(err => {
        console.warn(err);
      });
  };