VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.89k forks source link

[devel] Bug in Forms control: editing required fields #1942

Closed Apollinaire closed 6 years ago

Apollinaire commented 6 years ago

When on an edit form, on a required text input, if you delete every character it gets overwritten with what was previously prefilled.

How to reproduce: use Vulcan devel + Vulcan-starter, package example-forms. Create a new customer, let's call it Sacha, then click 'Edit' to open the edit modal form. In the field Name, remove every character. It's ok until you remove the first S, after what the field gets written with the full previous name, aka Sacha.

If i'm not being clear enough i'll provide screenshots

SachaG commented 6 years ago

Oh right, that makes sense. We need to add the field to deletedValues when it's cleared.

SachaG commented 6 years ago

Actually this code should already take care of it?

https://github.com/VulcanJS/Vulcan/blob/devel/packages/vulcan-forms/lib/components/FormComponent.jsx#L27-L30

Apollinaire commented 6 years ago

Yes it does work! We committed at the same time so I didn't have your change when I made the PR. You can close this I guess

SachaG commented 6 years ago

OK, can I close this then?

Apollinaire commented 6 years ago

I closed this and the PR :)