diff --git a/src/core/json-schema-components.jsx b/src/core/json-schema-components.jsx index 194059ead68..47a1981099e 100644 --- a/src/core/json-schema-components.jsx +++ b/src/core/json-schema-components.jsx @@ -171,7 +171,10 @@ export class JsonSchema_array extends PureComponent { render() { let { getComponent, required, schema, errors, fn, disabled } = this.props - errors = errors.toJS ? errors.toJS() : [] + errors = errors.toJS ? errors.toJS() : Array.isArray(errors) ? errors : [] + const arrayErrors = errors.filter(e => typeof e === "string") + const needsRemoveError = errors.filter(e => e.needRemove !== undefined) + .map(e => e.error) const value = this.state.value // expect Im List const shouldRenderValue = value && value.count && value.count() > 0 ? true : false @@ -210,10 +213,10 @@ export class JsonSchema_array extends PureComponent {
{shouldRenderValue ? (value.map((item, i) => { - if (errors.length) { - let err = errors.filter((err) => err.index === i) - if (err.length) errors = [err[0].error + i] - } + const itemErrors = fromJS([ + ...errors.filter((err) => err.index === i) + .map(e => e.error) + ]) return (
{ @@ -222,7 +225,7 @@ export class JsonSchema_array extends PureComponent { value={item} onChange={(val)=> this.onItemChange(val, i)} disabled={disabled} - errors={errors} + errors={itemErrors} getComponent={getComponent} /> : isArrayItemText ? @@ -230,13 +233,13 @@ export class JsonSchema_array extends PureComponent { value={item} onChange={(val) => this.onItemChange(val, i)} disabled={disabled} - errors={errors} + errors={itemErrors} /> : this.onItemChange(val, i)} disabled={disabled} - errors={errors} + errors={itemErrors} schema={schemaItemsSchema} getComponent={getComponent} fn={fn} @@ -244,7 +247,9 @@ export class JsonSchema_array extends PureComponent { } {!disabled ? ( ) : null} @@ -255,7 +260,8 @@ export class JsonSchema_array extends PureComponent { } {!disabled ? (