Skip to content

Commit 4793b9f

Browse files
authored
Fix TreeDropDownField no longer displaying dropdown options (#1196)
* Revert change in 095b773 that broke TreeDropDownField dropdown options * Rebuild bundle
1 parent 1ba4255 commit 4793b9f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

client/dist/js/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/components/TreeDropdownField/TreeDropdownField.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -701,9 +701,7 @@ class TreeDropdownField extends Component {
701701

702702
// Hack! Temporary fix until we can do a proper upgrade of react-select to >= 2.0.
703703
// eslint-disable-next-line func-names
704-
Select.prototype.componentDidUpdate = function (oldProps, oldState) {
705-
const nextProps = this.props;
706-
704+
Select.prototype.componentWillReceiveProps = function (nextProps) {
707705
function handleRequired(value, multi) {
708706
if (!value) {
709707
return true;
@@ -717,13 +715,13 @@ Select.prototype.componentDidUpdate = function (oldProps, oldState) {
717715
this.setState({
718716
required: handleRequired(valueArray[0], nextProps.multi)
719717
});
720-
} else if (oldProps.required) {
718+
} else if (this.props.required) {
721719
// Used to be required but it's not any more
722720
this.setState({ required: false });
723721
}
724722
// Array comparison in react-select is broken.
725-
const [current, next] = [oldProps.value, nextProps.value].map(JSON.stringify);
726-
if (oldState.inputValue && current !== next && nextProps.onSelectResetsInput) {
723+
const [current, next] = [this.props.value, nextProps.value].map(JSON.stringify);
724+
if (this.state.inputValue && current !== next && nextProps.onSelectResetsInput) {
727725
this.setState({ inputValue: this.handleInputValueChange('') });
728726
}
729727
};

0 commit comments

Comments
 (0)