Skip to content

Commit

Permalink
Fix <Select> clearable (#7215)
Browse files Browse the repository at this point in the history
closes #7213
related to
#6722 (comment)
  • Loading branch information
mistercrunch authored and betodealmeida committed Apr 3, 2019
1 parent 8830d3f commit e767e4d
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions superset/assets/src/explore/components/controls/SelectControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,24 @@ export default class SelectControl extends React.PureComponent {

onChange(opt) {
let optionValue = null;
if (!opt) {

This comment has been minimized.

Copy link
@agrawaldevesh

agrawaldevesh Apr 9, 2019

Thank you for fixing this !. Embarrassed to make this mistake :)

return;
}
if (this.props.multi) {
optionValue = [];
for (const o of opt) {
if (o.meta === true) {
optionValue = this.getOptions(this.props)
.filter(x => !x.meta)
.map(x => x[this.props.valueKey]);
break;
} else {
optionValue.push(o[this.props.valueKey]);
if (opt) {
if (this.props.multi) {
optionValue = [];
for (const o of opt) {
if (o.meta === true) {
optionValue = this.getOptions(this.props)
.filter(x => !x.meta)
.map(x => x[this.props.valueKey]);
break;
} else {
optionValue.push(o[this.props.valueKey]);
}
}
} else if (opt.meta === true) {
return;
} else {
optionValue = opt[this.props.valueKey];
}
} else if (opt.meta === true) {
return;
} else {
optionValue = opt[this.props.valueKey];
}
this.props.onChange(optionValue);
}
Expand Down

0 comments on commit e767e4d

Please sign in to comment.