-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[explorev2] making Datasource an Viz controls not clearable #1845
Conversation
@@ -50,10 +52,11 @@ export default class SelectField extends React.Component { | |||
return opt.label; | |||
} | |||
render() { | |||
const options = this.props.choices.map((c) => ({ value: c[0], label: c[1] })); | |||
const choices = this.props.choices || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could add choices: []
in defaultProps, to get rid of this line.
@@ -7,12 +7,13 @@ import Select, { Creatable } from 'react-select'; | |||
const propTypes = { | |||
name: PropTypes.string.isRequired, | |||
choices: PropTypes.array, | |||
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]).isRequired, | |||
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious why this is no longer required...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why it was there in the first place, seems like conceptually value
can be null
, especially if the field is clearable
, which they all were. I'd have to run some checks on master but I'm thinking this was throwing warnings and I removed the isRequired
to stop the warnings.
lgtm |
Other SelectField and new ones can now be set as non-clearable for places where null isn't right.