Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/components/SelectDropdown/SelectDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@ class SelectDropdown extends Component {
}

componentWillMount() {
let selectedOption = _.find(this.props.options, (o) => o.value === this.props.value)
if (!selectedOption) {
selectedOption = this.props.options[0]
}
this.setState({
selectedOption: this.props.selectedOption || this.props.options[0]
}, function() {
this.props.setValue(this.state.selectedOption)
})
selectedOption
}/*, function() {
// FIXME intentionally commented because it was causing multiple renders when used in mobility testing template
// Need to further analyze
// It does not seem to add any value either in both of its usage (it is used in App Screens section
// for design projects and in mobility testing projects)
this.props.setValue(this.state.selectedOption.value)
}*/)
}

handleClick(option) {
Expand All @@ -25,7 +33,7 @@ class SelectDropdown extends Component {
this.props.onSelect(this.state.selectedOption)
}
})
this.props.setValue(option)
this.props.setValue(option.value)
}

render() {
Expand Down
Loading