You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please specify what version of the library you are using: [latest]
Expected / Desired Behavior / Question
When using the errorMessage prop and reverting it to an empty string, it should remove the previous errorMessage
Observed Behavior
When clearing the errorMessage prop from the component, the previous errorMessage is not cleared. The componentWillReceiveProps method escapes the assignation of the new errorMessage only when there is a value.
public componentWillReceiveProps(nextProps: ITaxonomyPickerProps) {
let newState: ITaxonomyPickerState | undefined;
// Check if the initial values objects are not equal, if that is the case, data can be refreshed
if (!isEqual(this.props.initialValues, nextProps.initialValues)) {
newState = {
activeNodes: nextProps.initialValues || []
};
}
if (nextProps.errorMessage) {
if (!newState) {
newState = {};
}
newState.errorMessage = nextProps.errorMessage;
}
if (newState) {
this.setState(newState);
}
}
Steps to Reproduce
Create a component with the TaxonomyPicker
Create a state with an errorMessage variable containing a non-empty random string
Assign the errorMessage prop of the TaxonomyPicker with the state value previously assigned
Create a button with an onClick that setState of the errorMessage with an empty string
Notice that the errorMessage from the TaxonomyPicker is not cleared
Fix suggestion :
if (nextProps.errorMessage !== this.props.errorMessage) at line 93
Thanks!
The text was updated successfully, but these errors were encountered:
umaknow-jeanluc
changed the title
TaxonomyPicker errorMessage label not being removed
[TaxonomyPicker] errorMessage label not being removed
Jul 12, 2021
Category
[ ] Enhancement
[x] Bug
[ ] Question
Version
Please specify what version of the library you are using: [latest]
Expected / Desired Behavior / Question
When using the errorMessage prop and reverting it to an empty string, it should remove the previous errorMessage
Observed Behavior
When clearing the errorMessage prop from the component, the previous errorMessage is not cleared. The componentWillReceiveProps method escapes the assignation of the new errorMessage only when there is a value.
TaxonomyPicker
Steps to Reproduce
Fix suggestion :
if (nextProps.errorMessage !== this.props.errorMessage) at line 93
Thanks!
The text was updated successfully, but these errors were encountered: