From b70915098feb8a9c4af11733fedd9533a6afaf8f Mon Sep 17 00:00:00 2001 From: Omair Vaiyani Date: Mon, 14 Oct 2019 15:09:10 +0100 Subject: [PATCH] fix(GraphQL): Mutations not returning updated information (#6130) This issue was spotted when an updated field is modified in beforeSave, but the unmodified version is returned if requested by the resolver. For example ```graphql mutation UpdateTitle($id: ID!, $title: String!) { updateSomeObject(id: $id, fields: { title: $title }) { id title slug } } ``` In the above, if we modify the `title` by let's say, trimming it - the resolved `title` will not reflect this change, and instead just return the input variable. Other resolved fields that are not sent within the `fields` input are returned properly using the latest data. --- src/GraphQL/loaders/parseClassMutations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GraphQL/loaders/parseClassMutations.js b/src/GraphQL/loaders/parseClassMutations.js index 3d30f3d4..e62363b8 100644 --- a/src/GraphQL/loaders/parseClassMutations.js +++ b/src/GraphQL/loaders/parseClassMutations.js @@ -22,7 +22,7 @@ const getOnlyRequiredFields = ( const missingFields = selectedFields .filter( field => - (!updatedFields[field] && !nativeObjectFields.includes(field)) || + !nativeObjectFields.includes(field) || includedFields.includes(field) ) .join(',');