Skip to content

Commit bb48e66

Browse files
mandiwisebenjie
andauthored
Apply suggestions from code review
Co-authored-by: Benjie <[email protected]>
1 parent d472a10 commit bb48e66

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pages/learn/mutations.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { Callout } from "nextra/components"
66

77
Most discussions of GraphQL focus on data fetching, but any complete data platform needs a way to modify server-side data as well.
88

9-
In REST, any request might cause some side-effects on the server, but by convention, it's suggested that one doesn't use `GET` requests to modify data. GraphQL is similar—technically any query could be implemented to cause a data write. However, it's useful to establish a convention that any operations that cause writes should be sent explicitly via a mutation.
9+
In REST, any request might cause some side-effects on the server, but by convention, it's suggested that one doesn't use `GET` requests to modify data. GraphQL is similar—technically any field resolver could be implemented to cause a data write—but the [GraphQL specification states](https://spec.graphql.org/draft/#sel-GANRNDAB6DBmMn6D):
10+
11+
> the resolution of fields other than top-level mutation fields must always be side effect-free and idempotent
12+
13+
Thus only the top-level fields in mutation operations are allowed to cause side effects; to do otherwise would make your schema GraphQL non-compliant.
1014

1115
On this page, you'll learn how to use mutation operations to create, update, and delete data using GraphQL.
1216

0 commit comments

Comments
 (0)