Closed TarikHuber closed 6 years ago
I think the error might come from :
componentWillReceiveProps (nextProps) {
if (!areEqual(nextProps.value, this.state.selectedItems)) {
this.setState({ selectedItems: nextProps.value })
}
... and here the proptype definition for value:
const checkFormat = (value) => value.findIndex((v) => typeof v !== 'object' || !('value' in v))
value: (props, propName, componentName, location, propFullName) => {
const { multiple, value } = props
if (multiple) {
const index = checkFormat(value)
if (!Array.isArray(value)) {
return new Error(`
When using 'multiple' mode, 'value' of '${componentName} ${props.name}' must be an array.
Validation failed.`)
} else if (index !== -1) {
return new Error(`
'value[${index}]' of '${componentName} ${props.name}' must be an object including a 'value' property.
Validation failed.`)
}
so if value is set to wrong type (Array when multiple, primitive if not multiple), the above proptype snippet should throw an explicit error if value is set to null/undefined for any reason.
Can you give an example to repoduce this issue please, as my examples don't throw ?
Hi,
Just change the SSF in this file to multiple.
Even if you don't use the ReduxForm wrapper it happens.
Ok i reproduced the issue and found out that my initial guess were correct:
value
type properly depending on multiple mode. More specifically Field
seems to be uncontrolled, while SSF is a controlled-only component. This means it requires value and onChange handler. I did not find these props in RMW Task.js
Hi, Can you try with v1.8.9 : it should spit an error about invalid value prop ?
closing since no report
Hi @Sharlaan ,
Just to forward a issue I got over React Most Wanted.
First I was thinking that the issue was in our implementation of SuperSelectField to ReduxForm but it seems that it is a SuperSelectField issue. When using the multiple mode we get the error message: "Cannot read property 'some' of null" in this part of the code
It seems that selectedItems are null.
To be sure that the error is not form our implementation to ReduxForm I copied the example from "example2" into our code and the same error appears.
If I find time I will take a look on it myself but if you have it would be great to fix thiss issue. It seems like a issue that could affect everyone who is using the multiple mode.