Skip to content

Transition keeps children in state #825

@thomask

Description

@thomask

Description

After having had a populated error, removing the error will not actually remove the error from the DOM. Although there is a conditional, the Transition component will keep the outputted error div in its state.

Solution

Still need to research

Additional Information

As "show-message" is not implemented, and since we use the validation capabilities of react-jsonschema-form, we have overridden the onFieldBlur method of Form.Item:

class ValidatingFormItem extends Form.Item {
    onFieldBlur() {
        this.validate('blur');
        if (this.props['show-message'] && this.props.error) {
            this.setState(curState => {
                let newState = {
                    ...curState,
                    error: this.props.error
                }
                return newState;
            });
        } else {
            this.setState(curState => {
                let newState = {
                    ...curState,
                    error: ""
                };

                newState.valid = true;
                return newState;
            });
        }

        this.forceUpdate();
    }
}

Form.Item = ValidatingFormItem;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions