【发布时间】:2017-10-30 05:37:15
【问题描述】:
我正在尝试使用现在称为 Relay Classic 的 RANGE_ADD 突变(这可能已通过 Modern 解决)。我得到了错误:
Warning: writeRelayUpdatePayload(): Expected response payload to include the newly created edge `newThingEdge` and its `node` field. Did you forget to update the `RANGE_ADD` mutation config?
所以,是的,有效负载没有发送超出预期响应形状中的 clientMutationId 的任何内容,因为请求突变不要求它。
根据@Joe Savona https://github.com/facebook/relay/issues/521 的说法,如果没有相交的容器请求此数据,则可能会发生这种情况。但这对我来说并不完全正确。我的Route 请求:
things: (Component) => Relay.QL`
query {
allThings(variable: $variable) {
${Component.getFragment('things')},
}
}
`,
当我的 fatQuery 请求时:
fragment on AddMockThing {
allThings(variable: "${variable}", first: 100) {
edges {
node {
id,
},
},
},
newThingEdge
}
现在你可能会说这些不是同一个查询,因为getFatQuery 版本中有额外的first: 100,但如果我不使用它,我会收到错误:
Error: Error: You supplied the 'edges' field on a connection named 'allThings', but you did not supply an argument necessary to do so. Use either the 'find', 'first', or 'last' argument.
另一方面,如果我将 first: 100 添加到 Route 查询中,我会收到错误:Error: Invalid root field 'allThings'; Relay only supports root fields with zero or one argument.
卡在 fatQuery 和困难的地方之间。非常感谢您的帮助!
【问题讨论】:
标签: relayjs