Skip to content

Commit

Permalink
fix(GraphQL): Mutations not returning updated information (parse-comm…
Browse files Browse the repository at this point in the history
…unity#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.
  • Loading branch information
omairvaiyani authored and douglasmuraoka committed Oct 14, 2019
1 parent 0a74b62 commit 0c5af4c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/GraphQL/loaders/parseClassMutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getOnlyRequiredFields = (
const missingFields = selectedFields
.filter(
field =>
(!updatedFields[field] && !nativeObjectFields.includes(field)) ||
!nativeObjectFields.includes(field) ||
includedFields.includes(field)
)
.join(',');
Expand Down

0 comments on commit 0c5af4c

Please sign in to comment.