-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional arguments in hasura not working after migrating to hasura cloud #6660
Comments
This is a breaking change in v2.0. From the release notes, behaviour changes section:
|
@tirumaraiselvan thanks for pointing out the changes. |
Was able to resolve this, thanks @tirumaraiselvan |
Hi @lakhansamani , what was your approach to the problem ? |
@bobymicroby I used template literal here is an example export const getQuery = (data) => {
let query = `
firstName: $firstName
lastName: $lastName
gender: $gender
nationality: $nationality
phone: $phone
`;
// for optional arguments
if (data.isVerified) {
query += `\n isVerified: $isVerified`
}
// final mutation
const updateUser = gql`
mutation updateProfile(
$id: uuid!
$firstName: String!
$lastName: String!
$gender: String!
$nationality: String!
$phone: String!
$isVerified: Boolean
) {
update_auth_users(
where: { id: { _eq: $id } }
_set: {
${query}
}
) {
affected_rows
}
}
`;
`
} |
@lakhansamani Thanks for the answer! Since we are using TS & GraphQL generator for type safety, I will probably make Thanks again! |
Bug Details
With v1.3.3 following query used to work with an optional parameter
In the above query
$isVerified
is optional when it was not was passed it returned all the fields which is the expected behaviour.After migrating to Hasura cloud version
v2.0.0-alpha.2.cloud.2
The above query gives the following error when
$isVerified
is not passed.The text was updated successfully, but these errors were encountered: