小编don*_*ntc的帖子

ApolloClient v3 fetchMore 带有嵌套查询结果

我正在使用 ApolloClient 3 GitHub GraphQL API 从存储库检索所有版本。

查询如下所示:

query ($owner: String!, $name: String!, $first: Int, $after: String, $before: String) {
  repository(owner: $owner, name: $name) {
    id
    releases(orderBy: {field: CREATED_AT, direction: DESC}, first: $first, after: $after, before: $before) {
      nodes {
        name
        publishedAt
        resourcePath
        tagName
        url
        id
        isPrerelease
        description
        descriptionHTML
      }
      totalCount
      pageInfo {
        endCursor
        hasNextPage
        hasPreviousPage
        startCursor
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

结果有效负载如下所示:

查询结果负载

这将返回前 x 个条目 ( nodes)。到目前为止,一切都很好。

我需要实现分页,并且使用fetchMoreApolloClient 提供的功能useQuery。调用fetchMore成功获取下一个 x 条目,但这些条目未显示在我的组件列表中。

根据ApolloClient …

apollo reactjs graphql apollo-client github-graphql

5
推荐指数
1
解决办法
2942
查看次数

标签 统计

apollo ×1

apollo-client ×1

github-graphql ×1

graphql ×1

reactjs ×1