I have setup react-admin with Hasura (GraphQL API on Postgres) using the ra-data-hasura provider and I ran into an error when trying to update a record in an existing table.
I have this field tags
with type varchar[] which is delivered by the fetch API in the format: tags: ["A", "B"]
, but the problem is that the UPDATE API expects the format tags: "{A,B}"
.
Therefore all UPDATE requests will fail.
I already tried the parse()
and format()
functions on the InputField, but they are not changing the initial value of the record. The update will still fail if the tags
field is left untouched.
This is the API's (Hasura) error message in response to the UPDATE request. (just putting it here so other people might find this post)
{
"path": "$.args.$set",
"error": "A string is expected for type : _varchar",
"code": "parse-failed"
}
Is there a way to transform the value for tags
in react-admin without having to modify the API?