在 Relay.js 中,`Client Mutation Identifier` 是什么?
In Relay.js, what is the `Client Mutation Identifier`?
在中继文档 here 中,它说:
Relay uses a common pattern for mutations, where there are root fields on the mutation type with a single argument, input, and where the input and output both contain a client mutation identifier used to reconcile requests and responses.
但在他们提供的示例中,输入和输出分别如下所示:
// IntroducedShipInput
{
"input": {
"shipName": "B-Wing",
"factionId": "1"
}
}
// IntroducedShipPayload
{
"introduceShip": {
"ship": {
"id": "U2hpcDo5",
"name": "B-Wing"
},
"faction": {
"name": "Alliance to Restore the Republic"
}
}
}
那么 client mutation
标识符是什么?为什么以及如何使用它来协调请求和响应?
我仍然不能 100% 确定 "client mutation identifier," 究竟发生了什么,但经过一些研究,它似乎是 Relay 以前版本的要求。 This PR apparently removed the requirement by replacing it with some other mechanism, but it's not clear to me what that other mechanism does. I left a comment requesting more clarification around the documentation,似乎已过时。
无论如何,客户端变异标识符appears to have been related to some assumptions about mutation idempotency in Facebook's implementation of GraphQL。
在中继文档 here 中,它说:
Relay uses a common pattern for mutations, where there are root fields on the mutation type with a single argument, input, and where the input and output both contain a client mutation identifier used to reconcile requests and responses.
但在他们提供的示例中,输入和输出分别如下所示:
// IntroducedShipInput
{
"input": {
"shipName": "B-Wing",
"factionId": "1"
}
}
// IntroducedShipPayload
{
"introduceShip": {
"ship": {
"id": "U2hpcDo5",
"name": "B-Wing"
},
"faction": {
"name": "Alliance to Restore the Republic"
}
}
}
那么 client mutation
标识符是什么?为什么以及如何使用它来协调请求和响应?
我仍然不能 100% 确定 "client mutation identifier," 究竟发生了什么,但经过一些研究,它似乎是 Relay 以前版本的要求。 This PR apparently removed the requirement by replacing it with some other mechanism, but it's not clear to me what that other mechanism does. I left a comment requesting more clarification around the documentation,似乎已过时。
无论如何,客户端变异标识符appears to have been related to some assumptions about mutation idempotency in Facebook's implementation of GraphQL。