mirror of
https://github.com/wassname/talk.git
synced 2026-07-06 05:17:19 +08:00
Merge pull request #1100 from coralproject/fix-withMutation-hoc
Prevent calling updators when there is an error
This commit is contained in:
@@ -108,7 +108,7 @@ export default (document, config = {}) => hoistStatics((WrappedComponent) => {
|
||||
res[key] = (prev, result) => {
|
||||
if (getResponseErrors(result.mutationResult)) {
|
||||
|
||||
// Do not run updates when we have mutation errors.
|
||||
// Do not run updates when we have mutation errors.
|
||||
return prev;
|
||||
}
|
||||
return map[key](prev, result) || prev;
|
||||
@@ -116,6 +116,11 @@ export default (document, config = {}) => hoistStatics((WrappedComponent) => {
|
||||
} else {
|
||||
const existing = res[key];
|
||||
res[key] = (prev, result) => {
|
||||
if (getResponseErrors(result.mutationResult)) {
|
||||
|
||||
// Do not run updates when we have mutation errors.
|
||||
return prev;
|
||||
}
|
||||
const next = existing(prev, result);
|
||||
return map[key](next, result) || next;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user