Only set dirtyValue on valid change.

This commit is contained in:
orangemug 2020-01-19 11:41:37 +00:00
parent 926969b921
commit 0726a494be

View file

@ -48,10 +48,13 @@ class NumberInput extends React.Component {
const hasChanged = this.props.value !== value; const hasChanged = this.props.value !== value;
if(this.isValid(value) && hasChanged) { if(this.isValid(value) && hasChanged) {
this.props.onChange(value) this.props.onChange(value)
this.setState({
dirtyValue: newValue,
});
} }
this.setState({ this.setState({
value: newValue, value: newValue,
dirtyValue: newValue,
}) })
} }