From a13b1441bca40cfef6c606b7a8abf5a5b85ada7b Mon Sep 17 00:00:00 2001 From: Jed Watson Date: Wed, 13 Sep 2017 02:38:37 +1000 Subject: [PATCH] Required was not being updated without an onChange handler --- HISTORY.md | 1 + src/Select.js | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 9432bf05a3..f740e35329 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ * changed; by default, the menu for multi-selects now closes when an option is selected * fixed; `Async` component always called `onChange` even when it wasn't provided * fixed; input lag for the `Async` component when results are returned from cache +* fixed; required was not being updated without an onChange handler ## v1.0.0-rc.8 / 2017-09-12 diff --git a/src/Select.js b/src/Select.js index 3a3d0b9831..a46e3ca514 100644 --- a/src/Select.js +++ b/src/Select.js @@ -496,15 +496,16 @@ class Select extends React.Component { if (this.props.autoBlur) { this.blurInput(); } - if (!this.props.onChange) return; if (this.props.required) { const required = this.handleRequired(value, this.props.multi); this.setState({ required }); } - if (this.props.simpleValue && value) { - value = this.props.multi ? value.map(i => i[this.props.valueKey]).join(this.props.delimiter) : value[this.props.valueKey]; + if (this.props.onChange) { + if (this.props.simpleValue && value) { + value = this.props.multi ? value.map(i => i[this.props.valueKey]).join(this.props.delimiter) : value[this.props.valueKey]; + } + this.props.onChange(value); } - this.props.onChange(value); } selectValue (value) {