.mutate() does not autodeclare variables
flewellyn opened this issue · comments
Avi Blackmore commented
When I use the .query() helper method with autodeclare, it works perfectly. However, .mutate() does not autodeclare the variables for input.
I can still use the main function and enter the full mutation syntax, with manual declarations. But having the helper method work properly would be nice.
Fatih Kadir Akın commented
Yes, mutate cannot autodeclare input.
You should use field!Type
syntax to help autodeclaration.
graph.mutate(gql`(@autodeclare) {
userCreate(input: $input) {
user {
...userInfo
}
}
}`, { 'input!UserCreateInput': { name: "Fatih", surname: "Akin" } });
Avi Blackmore commented
Ahh, I see. Yes, this works nicely. Thank you.