From fab004cdfe4de1446074fd60e50b1d775a8d26d7 Mon Sep 17 00:00:00 2001 From: jirik Date: Mon, 16 Jan 2017 13:31:02 +0100 Subject: [PATCH] StringInput fires change if state and props values do not match Now it is also possible to call onChange listener if new value is empty string --- src/components/inputs/StringInput.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/inputs/StringInput.jsx b/src/components/inputs/StringInput.jsx index f9fb56e4..34a550a3 100644 --- a/src/components/inputs/StringInput.jsx +++ b/src/components/inputs/StringInput.jsx @@ -27,7 +27,7 @@ class StringInput extends React.Component { placeholder={this.props.default} onChange={e => this.setState({ value: e.target.value })} onBlur={() => { - if(this.state.value) this.props.onChange(this.state.value) + if(this.state.value!==this.props.value) this.props.onChange(this.state.value) }} /> }