接力现代:refetch不更新道具

时间:2017-11-12 16:24:03

标签: reactjs graphql relay relaymodern react-relay

我正在尝试使用Relay Modern的createRefetchContainer。但是道具不会从重新获取查询的结果传递给我的组件。重新获取查询运行正常,响应将从服务器返回,但ui不会更新。或者更确切地说,重新获取容器的道具不会更新。

这是我的继电器装饰:

@compose(
  queryRenderer(graphql`
      query UsersQuery($page: Int, $count: Int) {
          users(page: $page, count: $count) {
              ...Users_users
          }
      }
  `, {
    page: 1,
    count: 25
  }),
  refetchContainer(
    graphql`
        fragment Users_users on UserPaginationResult {
            data {
                ...UserRow_user
            }
            pageInfo {
                totalCount
                pagesCount
            }
        }
    `,
    graphql`
        query UsersRefetchQuery($page: Int!,$count: Int!) {
            users(page: $page, count: $count) {
                ...Users_users
            }
        }
    `
  )
)

这是我的重新获取功能:

loadMore(page) {
    const { count } = this.state;
    const { relay: { refetch } } = this.props;

    refetch({ page, count });
  }

版本:

"react-relay": "^1.4.1",
"relay-compose": "^1.0.6",
"relay-runtime": "^1.4.1"

0 个答案:

没有答案