GraphQL mutations not only use key to identify a result, but instead use
an identity to mark which result belongs to them.
While two GraphQL queries and subscriptions sharing the same variables and the same operation
(i.e. DocumentNode) are considered identical, two mutations are not.
Two GraphQL queries or subscription results with the same key can be used
to resolve any GraphQLRequest with this same key.
This is because identical queries and subscriptions are idempotent.
However, two mutations with the same variables may receive different results from a GraphQL API,
since they may trigger side-effects.
This means that urql needs an additional identifier to differentiate between two mutations with
the same DocumentNodes and variables.
A unique identity for GraphQL mutations.
Remarks
GraphQL mutations not only use key to identify a result, but instead use an identity to mark which result belongs to them.
While two GraphQL queries and subscriptions sharing the same variables and the same operation (i.e.
DocumentNode
) are considered identical, two mutations are not. Two GraphQL queries or subscription results with the same key can be used to resolve any GraphQLRequest with this samekey
. This is because identical queries and subscriptions are idempotent.However, two mutations with the same variables may receive different results from a GraphQL API, since they may trigger side-effects. This means that
urql
needs an additional identifier to differentiate between two mutations with the sameDocumentNode
s andvariables
.