Skip to content

Commit 617bb04

Browse files
committed
Do not raise an error when no clientMutationId is provided
Instead, return None (relays-js would return undefined here).
1 parent 5d78b47 commit 617bb04

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/graphql_relay/mutation/mutation.py

+2-14
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,7 @@ def augmented_output_fields() -> GraphQLFieldMap:
8080
# noinspection PyShadowingBuiltins
8181
async def resolve(_root: Any, info: GraphQLResolveInfo, input: Dict) -> Any:
8282
payload = await mutate_and_get_payload(info, **input)
83-
try:
84-
clientMutationId = input["clientMutationId"]
85-
except KeyError:
86-
raise GraphQLError(
87-
"Cannot set clientMutationId"
88-
f" in the payload object {inspect(payload)}."
89-
)
83+
clientMutationId = input.get("clientMutationId")
9084
if payload is None:
9185
payload = NullResult(clientMutationId)
9286
else:
@@ -100,13 +94,7 @@ def resolve( # type: ignore
10094
_root: Any, info: GraphQLResolveInfo, input: Dict
10195
) -> Any:
10296
payload = mutate_and_get_payload(info, **input)
103-
try:
104-
clientMutationId = input["clientMutationId"]
105-
except KeyError:
106-
raise GraphQLError(
107-
"Cannot set clientMutationId"
108-
f" in the payload object {inspect(payload)}."
109-
)
97+
clientMutationId = input.get("clientMutationId")
11098
if payload is None:
11199
payload = NullResult(clientMutationId)
112100
else:

0 commit comments

Comments
 (0)