【问题标题】:In Relay.js, what is the `Client Mutation Identifier`?在 Relay.js 中,什么是 `Client Mutation Identifier`?
【发布时间】:2020-06-08 20:39:57
【问题描述】:

在中继文档here 中,它说:

Relay 使用一种通用的突变模式,其中突变类型的根字段具有单个参数、输入,并且输入和输出都包含用于协调请求的客户端突变标识符和回应。

但在他们提供的示例中,输入和输出分别如下所示:

// IntroducedShipInput
{
  "input": {
    "shipName": "B-Wing",
    "factionId": "1"
  }
}

// IntroducedShipPayload
{
  "introduceShip": {
    "ship": {
      "id": "U2hpcDo5",
      "name": "B-Wing"
    },
    "faction": {
      "name": "Alliance to Restore the Republic"
    }
  }
}

那么client mutation 标识符是什么?为什么以及如何使用它来协调请求和响应?

【问题讨论】:

标签: graphql graphql-js relayjs relay relaymodern


【解决方案1】:

我仍然不能 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-14
    • 1970-01-01
    • 1970-01-01
    • 2016-03-18
    • 1970-01-01
    • 2018-02-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多