I was tinkering around in my own toy project while following the graphql-react-apollo example, and apollo/client was just refusing to send the variable from the mutation.
So I found out that if you don't reference a variable that you define, apollo client does not send it. So:
mutation Login($username: String!) {
user {
id
firstName
lastName
}
}
But when I tested the project from the fork this issue didn't happen. It turns out that this is a new behavior that doesn't happen in "@apollo/client": "3.2.2, but it does in "@apollo/client": "^3.7.1"
However, even though with the current version this works, I think it's still wrong and should be fixed. I imagine that in the future people will be very confused by the example, as I was. So here's the fix, I didn't bump any versions, just the mutation. Let me know if you want me to bump the apollo/client version.
Changes
I was tinkering around in my own toy project while following the graphql-react-apollo example, and apollo/client was just refusing to send the variable from the mutation.
So I found out that if you don't reference a variable that you define, apollo client does not send it. So:
Should be:
But when I tested the project from the fork this issue didn't happen. It turns out that this is a new behavior that doesn't happen in
"@apollo/client": "3.2.2
, but it does in"@apollo/client": "^3.7.1"
However, even though with the current version this works, I think it's still wrong and should be fixed. I imagine that in the future people will be very confused by the example, as I was. So here's the fix, I didn't bump any versions, just the mutation. Let me know if you want me to bump the apollo/client version.