gerhat / material-ui-formik-components

Formik ready material ui components
MIT License
85 stars 13 forks source link

Null InitialValues doesn't work on AutoComplete with multiple option #31

Closed JbPons closed 4 years ago

JbPons commented 4 years ago

This issue is related to a previous fixed issue : #28

Now, with the last version of the Library I can't use autoComplete with multiple option without initialValue.

So I try to do: skills: null and skills: [null] I have a react error,.

After that I try in another way: skills: [{ label: '', value: ''}] This time it's work but I have an empty selected options.

You can find a working example here : https://codesandbox.io/s/nifty-turing-36dvv

viperz0r commented 4 years ago

Hi,

I tested your example with skills being an empty array and didn´t get any error:

const initialValues = { username: "", gender: "", country: "", skills: [], birthdate: null };

Does it solve your problem?

JbPons commented 4 years ago

Hello,

Yes it's solve my problem, Thanks.

But I think the library need to be update to handle the case I described in my previous commentary.

So, I don't close the issue to wait any update from the contributor.

gerhat commented 4 years ago

Hello. Thank you both for your comments.

I agree with @JbPons. null initial value should be handled properly. Version 0.6.3 prints an error message in the console when the value is null and does not render the field.

initial_value_null_error