在Relay.js中,什么是“客户端突变标识符”?

问题描述 投票:1回答:1

在继电器文档here中说:

中继对突变使用通用模式,其中突变类型的根字段具有单个参数,输入,而其中输入和输出均包含客户突变标识符用于协调请求和响应。] >

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

// 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个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.