在中继文档中 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% 确定“客户端突变标识符”究竟发生了什么,但是经过一些研究,它似乎是 Relay 以前版本中的一个要求。 This PR apparently removed the requirement通过用其他一些机制替换它,但我不清楚其他机制的作用。 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 .
关于graphql - 在 Relay.js 中, `Client Mutation Identifier` 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60389096/