From eab42ccece180ad4d96df9846dfc3fa08bcddf66 Mon Sep 17 00:00:00 2001 From: Evgeny Kochetkov Date: Tue, 12 Feb 2019 17:12:17 +0300 Subject: [PATCH] =?UTF-8?q?tweak(xod-client):=20add=20optional=20=E2=80=98?= =?UTF-8?q?forceCommit=E2=80=99=20flag=20to=20Widget=E2=80=99s=20`updateVa?= =?UTF-8?q?lue`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s quite useful in hotkey handlers --- .../src/editor/components/inspectorWidgets/Widget.jsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/xod-client/src/editor/components/inspectorWidgets/Widget.jsx b/packages/xod-client/src/editor/components/inspectorWidgets/Widget.jsx index 340376df..6a7cfc7e 100644 --- a/packages/xod-client/src/editor/components/inspectorWidgets/Widget.jsx +++ b/packages/xod-client/src/editor/components/inspectorWidgets/Widget.jsx @@ -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); }