首页 > 解决方案 > github graphql api,“clientMutationId”是什么意思?

问题描述

我在示例强类型文档中看到了clientMutationId字段。

mutation {
  addComment(input:{clientMutationId: 1234, subjectId: "MDA6SXNzdWUyMjcyMDA2MTT=", body: "Looks good to me!"}) {
    clientMutationId
    commentEdge {
      node {
        body
        repository {
          id
          name
          nameWithOwner
        }
        issue {
          number
        }
      }
    }
  }
}

是什么clientMutationId意思?我怎样才能生成它?

标签: graphqlgithub-apirelaygithub-graphqlgraphql-relay

解决方案


clientMutationId与 GraphQL 没有直接关系,但与graphql-relay有直接关系。

检查了解中继突变以获得更好的解释。

客户端突变 ID。此 ID 由 Relay 客户端在后台生成,用于跟踪突变的进度。


推荐阅读