tweak(xod-client): add optional ‘forceCommit’ flag to Widget’s updateValue

It’s quite useful in hotkey handlers
This commit is contained in:
Evgeny Kochetkov
2019-02-12 17:12:17 +03:00
parent 84b55a6edb
commit eab42ccece

View File

@@ -59,10 +59,9 @@ class Widget extends React.Component {
}
}
updateValue(value) {
const commitCallback = this.props.commitOnChange
? this.commit.bind(this)
: noop;
updateValue(value, forceCommit = false) {
const commitCallback =
this.props.commitOnChange || forceCommit ? this.commit.bind(this) : noop;
this.setState({ value }, commitCallback);
}