-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
apolloClient.mutate variables not working #2762
Comments
I tried your example project, this seems to work fine: apolloClient.mutate({
variables: { text: "hello" },
mutation: gql`
mutation AddComment($text: String!){
addComment(text: $text) {
id
text
}
}
`,
})
.then(result => { console.log(result) })
.catch(error => { console.log(error) }); |
@jarnojellesma Any insight on the cause of this? Seems to be happening to me right now :( |
As mentioned in #2762 (comment), the reproduction seems to work properly when tested. If this continues to be a problem, please post back with an updated reproduction that shows the issue happening. Thanks! |
@jarnojellesma I'm running into the same issue. Did you ever resolve this? |
If i wanted to add a custom type in variables, like instead of string, i wanted to add a custom object type, how will i add. $text:String, instead, i want to put something like $text:Message, how do i define that on the client |
This is because variables need to be handled on the server side. Nothing to do with client, same as apollographql/react-apollo#164 @masiamj @marcotc |
Thankx @vigoss6666 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Intended outcome:
Variable merged into the mutation
Actual outcome:
Status: 400 error with variable, and the mutation works when hard-coding the value in the mutation:
How to reproduce the issue:
https://github.com/jarnojellesma/graphql-experiment
Version
The text was updated successfully, but these errors were encountered: