Actions
Bug #33647
closedGraphQL response should return valid attribute values
Description
When we are updating models via GraphQL, we assign new attribute values to the model and save (BaseMutation#save_object).
If there are validation errors, the model with invalid attribute values is used for response. This is causing problems in UI with as Apollo detects a change in an attribute and places the new (invalid) value into its cache. To leverage Apollo's automatic cache updates, we should return the persisted value, not the assigned and invalid.
Steps to reproduce:
variables = { id: model_global_id, name: '' } mutation UpdateModelMutation($id: ID!, $name: String) { updateModel(input: { id: $id, name: $name }) { model { id name } errors { path message } } }
Expected Result:
{ updateModel { model { id: 'very_long_global_id', name: 'My model' }, errors: [{ path: ["attributes", "name"], message: "can't be blank" }] } }
Actual Result:
{ updateModel { model { id: 'very_long_global_id', name: '' }, errors: [{ path: ["attributes", "name"], message: "can't be blank" }] } }
Updated by The Foreman Bot almost 3 years ago
- Status changed from New to Ready For Testing
- Assignee set to Ondřej Pražák
- Pull request https://github.com/theforeman/foreman/pull/8819 added
Updated by Ondřej Pražák almost 3 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman|d0f5a61bf61b3300f687f219f3c1bb15d06e0d98.
Actions