-
Notifications
You must be signed in to change notification settings - Fork 786
Optional input is set to null #1569
Comments
I agree with @jurajkrivda . Nullable input when not presented within the query variables in apollo client, is getting called with Client should not pass the whole input as Passing |
I have a similar problem. I was able to solve it with a utility function that passes only into the request variables: utils.js
And then in my mutation:
|
Something new on this ? I recently upgraded my package.json configuration (for a professional project) and it led to a huge backward incompatibility. I used to handle "null" as an explicit value ("set this field to null in the database") and undefined as a way to tell the server there's nothing to change, it's just an optional parameter that was omitted. My fix was just to force the install of an earlier version of the apollo server. By setting optional parameters to null, how do you even make the difference between omitted optional parameters and the actual value "null" ? |
We're having the same issue, any thoughts ? |
Same - we check every version against our test suite and have not been able to update past react-apollo 2.1.11 due to this issue. I believe that is the newest version that correctly implements the graphql spec as @dacz mentioned above. |
Tested with 2.4.1 and 2.5.0 beta and issue still persists (is easy to repro with the the info in the issue description). Would love to know if this is intended behavior or not. |
Same, very boring !! |
Same issue, would love an update! Playing with a gross workaround until something more elegant is suggested. In this example, I'm trying to rehydrate my client cache with some remote data. With all of these fields being optional, if no remote data exist, I'm calling the mutation without some variables and it's setting them to null. In your writeQuery data, you can have some ternary logic to handle default values or set as undefined.
|
This is now an issue for more than a year. Several threads were opened about it on Github. Still nothing changed. We didn't even get a proper explanation. This was a major break in regards to backward compatibility and a lot of people are concerned with this. Can we get an answer, please ? |
@jurajkrivda have you tried to use the default scalar |
Setting optional inputs to |
Hello. I have a "users" request with userFilterInput which is optional. In my case i do not set the filter. Apollo will send this request to the server
Why userFilterInput is set to null and not to undefined? Bellow you can find my code and you can see that I did not set up any filter.
The text was updated successfully, but these errors were encountered: