Skip to content

Commit 85f2c1b

Browse files
author
Vikas Agarwal
committed
Github issue#1198, Mobility Testing product on Connect
— Fixed template to have valid fieldName for questions — Added `select-dropdown` field type support for normal project template sections. Earlier it was limited only to the `App Screens` section because of some tech debt carried forward from community. — Fixed `select-dropdown` field type to save value instead of the complete option object — Fixed issue with SelectDropdown component which was preventing the newly added Mobility Testing template to not load.
1 parent be46e63 commit 85f2c1b

File tree

7 files changed

+523
-14
lines changed

7 files changed

+523
-14
lines changed

src/components/SelectDropdown/SelectDropdown.jsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@ class SelectDropdown extends Component {
1212
}
1313

1414
componentWillMount() {
15+
let selectedOption = _.find(this.props.options, (o) => o.value === this.props.value)
16+
if (!selectedOption) {
17+
selectedOption = this.props.options[0]
18+
}
1519
this.setState({
16-
selectedOption: this.props.selectedOption || this.props.options[0]
20+
selectedOption: selectedOption
1721
}, function() {
18-
this.props.setValue(this.state.selectedOption)
22+
// FIXME intentionally commented because it was causing multiple renders when used in mobility testing template
23+
// Need to further analyze
24+
// It does not seem to add any value either in both of its usage (it is used in App Screens section
25+
// for design projects and in mobility testing projects)
26+
27+
// this.props.setValue(this.state.selectedOption.value)
1928
})
2029
}
2130

@@ -25,7 +34,7 @@ class SelectDropdown extends Component {
2534
this.props.onSelect(this.state.selectedOption)
2635
}
2736
})
28-
this.props.setValue(option)
37+
this.props.setValue(option.value)
2938
}
3039

3140
render() {

0 commit comments

Comments
 (0)