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.
This commit is contained in:
Omair Vaiyani
2019-10-14 15:09:10 +01:00
committed by Douglas Muraoka
parent 44c77fa85f
commit b70915098f

View File

@@ -22,7 +22,7 @@ const getOnlyRequiredFields = (
const missingFields = selectedFields
.filter(
field =>
(!updatedFields[field] && !nativeObjectFields.includes(field)) ||
!nativeObjectFields.includes(field) ||
includedFields.includes(field)
)
.join(',');