我正在尝试使用createRefetchContainer
Relay Modern。但是道具不会从重新获取查询的结果中传递给我的组件。重新获取查询运行正常,响应将从服务器返回,但 ui 没有得到更新。或者更准确地说,refetch 容器的 props 没有得到更新。
这是我的继电器装饰器:
@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"