4
votes

In the relay documentation here, it says that:

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.

But in the example they provided, the input and output looked like this respectively:

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

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

So what is the client mutation identifier? And why, and how does it get used to reconcile requests and responses?

1
inside they are taking unique identifier name clientMutationId while perfoming mutationMayank Pandav
@MayankPandav Can you elaborate inside what are who taking unique identifier names?davidx1
i.postimg.cc/pdLv4GjY/Screenshot-from-2020-03-03-09-39-36.png kindly checkout it will automatically taake its value even idk what they used to takeMayank Pandav

1 Answers

1
votes

I'm still not 100% sure what exactly happened to the "client mutation identifier," but having done some research, it appears to have been a requirement in previous versions of 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, which appears to be out of date.

At any rate, the client mutation identifier appears to have been related to some assumptions about mutation idempotency in Facebook's implementation of GraphQL.