React-Select + redux form 6 - After clearing Select.Creatable values redux form field still shows under values.(empty though)
Hello,
I am using react-select 1.0* - Select.Creatable+multi options feature with redux form 6. everything works as expected, redux form creates field as a form Field and values etc. only thing I observed is after clearing all the values. Redux form still shows Field under values section of the form as empty array. Problem is when I will submit the form, redux form will send an empty array field to the server. I want to keep this field non mandatory so I can not force user to select at least one value once touched.
hear is my code:
in render()
<Field name="field name" type="text"
component={this.renderFields} sourceData={dataArray}/>
renderFields:
renderFields = ({input, name, label, currentAttribute, meta: {touched, error}}) => {
let currentValues = sourceData.dataValue;
return (
<div>
<Select.Creatable
options = {
currentValues.map((item, index)=>{
return{value: item['value'], label: item['value']}
})
}
{...input}
onBlur={() => input.onBlur(input.value) }
multi={true}
/>
</div>
)}
Below is the screen shot of form fields in console.
