-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect errorPolicy for mutation and subscription results. (#7003)
Using the default ErrorPolicy of "none" for queries means no data will be written to the cache when a GraphQL result has errors. Queries can use errorPolicy:"ignore" and errorPolicy:"all" to ensure data is written to the cache in spite of GraphQL errors, but mutations and subscriptions were previously limited to the default policy, "none". This commit makes mutations and subscriptions respect the non-default "ignore" and "all" ErrorPolicy values, just as queries do, hopefully addressing #6965.
- Loading branch information
Showing
6 changed files
with
166 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`mutation results should write results to cache according to errorPolicy 1`] = `Object {}`; | ||
|
||
exports[`mutation results should write results to cache according to errorPolicy 2`] = ` | ||
Object { | ||
"Person:{\\"name\\":\\"Jenn Creighton\\"}": Object { | ||
"__typename": "Person", | ||
"name": "Jenn Creighton", | ||
}, | ||
"ROOT_MUTATION": Object { | ||
"__typename": "Mutation", | ||
"newPerson({\\"name\\":\\"Jenn Creighton\\"})": Object { | ||
"__ref": "Person:{\\"name\\":\\"Jenn Creighton\\"}", | ||
}, | ||
}, | ||
} | ||
`; | ||
exports[`mutation results should write results to cache according to errorPolicy 3`] = ` | ||
Object { | ||
"Person:{\\"name\\":\\"Ellen Shapiro\\"}": Object { | ||
"__typename": "Person", | ||
"name": "Ellen Shapiro", | ||
}, | ||
"Person:{\\"name\\":\\"Jenn Creighton\\"}": Object { | ||
"__typename": "Person", | ||
"name": "Jenn Creighton", | ||
}, | ||
"ROOT_MUTATION": Object { | ||
"__typename": "Mutation", | ||
"newPerson({\\"name\\":\\"Ellen Shapiro\\"})": Object { | ||
"__ref": "Person:{\\"name\\":\\"Ellen Shapiro\\"}", | ||
}, | ||
"newPerson({\\"name\\":\\"Jenn Creighton\\"})": Object { | ||
"__ref": "Person:{\\"name\\":\\"Jenn Creighton\\"}", | ||
}, | ||
}, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters