tweak(xod-client): remove redundant state part in Widget component

This commit is contained in:
Evgeny Kochetkov
2017-02-27 18:01:47 +03:00
parent a1a4a4b67f
commit 006b22d1c9

View File

@@ -14,10 +14,10 @@ export default function composeWidget(Component, widgetProps) {
this.commit();
},
[KEYCODE.ESCAPE]: function escape(event) {
if (this.state.value === this.state.initialValue) {
if (this.state.value === this.parseValue(this.props.value)) {
event.target.blur();
} else {
this.updateValue(this.state.initialValue);
this.updateValue(this.props.value);
}
},
};
@@ -30,7 +30,6 @@ export default function composeWidget(Component, widgetProps) {
const val = this.parseValue(props.value);
this.state = {
initialValue: val,
value: val,
};