Has there been a recent breaking change on how graphql-variables are used when updating fields? When calling an update mutation on a record, the fields that are included in the field list in the mutation but are not included in the variables, will be cleared on the record. Previously these fields were ignored in the update, and they would still contain the original value from before the mutation. For the last couple of months we have successfully used an update method that allows us to update over 20 fields on the Customer record. Recently we noticed that many of the fields in our records were blank. We eventually found the cause of this was the update method. For example, if the method was called to update one single field, all the other fields in the update mutation were cleared. Our first record of this happening was on 16.05. On 15.05 it was working correctly. We have not changed our code during this period. Example of a query for getting customer info: query GetCustomer(
$companyID: Int!,
$customerNo: Int!
)
{
useCompany(no: $companyID) {
associate(filter: { customerNo: { _eq: $customerNo } }) {
items {
customerNo
phone
mobilePhone
privatePhone
}
}
}
} If we call the query with the following variables: {
"companyID" : 4000000,
"customerNo": 11000
} we get the result: {
"data": {
"useCompany": {
"associate": {
"items": [
{
"customerNo": 11000,
"phone": "90000000",
"mobilePhone": "91000000",
"privatePhone": "92000000"
}
]
}
}
}
} Then, if we call the following mutation: mutation UpdateCompany(
$companyID: Int!
$customerNo: Int!,
$phone: String,
$mobilePhone: String,
$privatePhone: String,
)
{
useCompany(no: $companyID) {
associate_update(
filter:
{
customerNo: { _eq: $customerNo }
},
value:
{
phone: $phone
mobilePhone: $mobilePhone
privatePhone: $privatePhone
}
)
{ affectedRows }
}
} with these variables (mobilePhone and privatePhone are not included): {
"companyID" : 4000000,
"customerNo": 11000,
"phone": "94000000"
} the three values will all be updated. The phone field will be updated with the new phone number. The mobilePhone and privatePhone filed will be set to blank. Previously these two fields would not be updated. They would still have the same value that they contained before the mutation. When querying again the same customer, we get the result: {
"data": {
"useCompany": {
"associate": {
"items": [
{
"customerNo": 11000,
"phone": "94000000",
"mobilePhone": "",
"privatePhone": ""
}
]
}
}
}
}
... View more