diff --git a/src/modules/Dropdown/Dropdown.js b/src/modules/Dropdown/Dropdown.js index e9e195c09b..339120440d 100644 --- a/src/modules/Dropdown/Dropdown.js +++ b/src/modules/Dropdown/Dropdown.js @@ -423,7 +423,12 @@ export default class Dropdown extends Component { this.setSelectedIndex(nextProps.value) } - if (!_.isEqual(nextProps.options, this.props.options)) { + // The selected index is only dependent on option keys/values. + // We only check those properties to avoid recursive performance impacts. + // https://github.com/Semantic-Org/Semantic-UI-React/issues/3000 + if ( + !_.isEqual(this.getKeyAndValues(nextProps.options), this.getKeyAndValues(this.props.options)) + ) { this.setSelectedIndex(undefined, nextProps.options) } } @@ -787,6 +792,9 @@ export default class Dropdown extends Component { // Getters // ---------------------------------------- + getKeyAndValues = options => + (options ? options.map(option => _.pick(option, ['key', 'value'])) : options) + // There are times when we need to calculate the options based on a value // that hasn't yet been persisted to state. getMenuOptions = (value = this.state.value, options = this.props.options) => {