[4.0.0] The `value` prop supplied to <select> must be an array if `multiple` is true.
Opened this issue · 1 comments
jlowcs commented
I'm not sure if I'm doing something wrong, but since the bump I'm getting that error when using a <select multiple> component with a name that contains a path to an array.
The name passed to Field is roles[${idx}].scopes and I made sure that there is indeed an array inside of scopes.
jlowcs commented
Ah, I figured it out.
This fails:
<Field<StaffFormRole['scopes']> name={`roles[${idx}].scopes`} validate={required} type="select">
{({ input }) => (
<Select id={input.name} {...input} multiple>
...
</Select>
)}
</Field>This does not:
<Field<StaffFormRole['scopes']> name={`roles[${idx}].scopes`} validate={required} type="select">
{({ input: { value, ...input } }) => (
<Select id={input.name} value={value || []} {...input} multiple>
...
</Select>
)}
</Field>Should the library just handle undefined as a default [] for value?