You might say it's better to make the form not sen...
# orm-help
f
You might say it's better to make the form not send the email field in the mutation if it's empty. But how would I handle it if it's an edit form and the user is removing their email (thus leaving an empty string in the field)? Not sending it would make the original email remain there.
k
Assuming you're using JavaScript here for your client just set the email variable (the variable that's part of the mutation) to
undefined
.
Here's how I did it myself in my React + Apollo-client project. https://github.com/TiE23/metric-teacher/blob/master/client/src/components/user/UserDetailBasicsEditorForm.js#L68 (I wrote this component around 6 weeks into my experience with React. I now have around 5 months of experience so I can tell you this could all be written better, but it does work).
f
Thanks, I've gone with null though because that's what I found first.
k
Oh, I totally misread that - I was talking in the way that you didn't want to null the email. Then yeah, null will do you.