I am using AWS amplify with graphql and appsync. I have a field called myArray that is an array of strings. I would like to replace the value of myArray with a new array.
When I try to do this, graphql adds my input to the existing array, instead of replacing the array with my input.
How can I replace my array with a new array, instead of appending to the existing array. Here is my code and the result:
// My query:
updateFrame(input: {id: "94cf1635-a336-4619-99eb-53c081f57bea", myArray: ["new value"]}) {
id
testOrder
}
}```
// Mutated data
```{
"data": {
"updateFrame": {
"id": "94cf1635-a336-4619-99eb-53c081f57bea",
"myArray": [
"oldValue",
"oldValue",
"new value"
]
}
}```[
}
I've run into this as well. Note, my confidence that this is a correct answer is not 100%:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With