Nested update in Hasura
I want to implement below mutation
variables
Refine's generates
variables
error
3 Replies
Hi @narayandreamer. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It looks like you are trying to perform a nested update in Hasura using refine, but you are encountering an error because the
help_categories_metadata
field is not found in the help_categories_set_input
type.
Based on the provided information, refine's generated mutation does not support the nested update structure you are aiming for. Instead, you need to perform two separate operations: one for updating the help_categories
and another for inserting/updating the help_categories_metadata
.
Here is how you can achieve this using the provided mutation and variables:
Mutation
Variables
Explanation
1. Update help_categories
: This part of the mutation updates the help_categories
table with the provided help_category
data.
2. Insert/Update help_categories_metadata
: This part of the mutation inserts new metadata or updates existing metadata based on the on_conflict
constraint.
Error Resolution
The error field 'help_categories_metadata' not found in type: 'help_categories_set_input'
occurs because help_categories_metadata
is not a direct field of help_categories_set_input
. Instead, you need to handle metadata updates separately as shown in the mutation above.
By structuring your mutation this way, you can achieve the desired nested update functionality in Hasura.
For more information on how to use refine with Hasura, you can refer to the refine Hasura documentation (https://refine.dev/docs/data/packages/hasura/#utility-types).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@689530553313394880> kapa.ai is still learning and improving, please let us know how it did by reacting below
optimistic-goldOP•7mo ago
But I'm using useForm and want atomicity