diff --git a/.changeset/beige-eagles-jog.md b/.changeset/beige-eagles-jog.md new file mode 100644 index 0000000000..8afbbe7a85 --- /dev/null +++ b/.changeset/beige-eagles-jog.md @@ -0,0 +1,5 @@ +--- +"react-select": patch +--- + +Removed memoization of buildMenuOptions diff --git a/packages/react-select/src/Select.js b/packages/react-select/src/Select.js index 411549bc75..e1cf0b985a 100644 --- a/packages/react-select/src/Select.js +++ b/packages/react-select/src/Select.js @@ -1,7 +1,6 @@ // @flow import React, { Component, type ElementRef, type Node } from 'react'; -import memoizeOne from 'memoize-one'; import { MenuPlacer } from './components/Menu'; import { createFilter } from './filters'; @@ -978,33 +977,12 @@ export default class Select extends Component { return defaultComponents(this.props); }; - buildCategorizedOptionsFromPropsAndSelectValue = memoizeOne( - buildCategorizedOptions, - (newArgs: any, lastArgs: any) => { - const [newProps, newSelectValue] = (newArgs: [Props, OptionsType]); - const [lastProps, lastSelectValue] = (lastArgs: [Props, OptionsType]); - - return ( - newSelectValue === lastSelectValue && - newProps.inputValue === lastProps.inputValue && - newProps.options === lastProps.options - ); - } - ); buildCategorizedOptions = () => - this.buildCategorizedOptionsFromPropsAndSelectValue( - this.props, - this.state.selectValue - ); + buildCategorizedOptions(this.props, this.state.selectValue); getCategorizedOptions = () => this.props.menuIsOpen ? this.buildCategorizedOptions() : []; - buildFocusableOptionsFromCategorizedOptions = memoizeOne( - buildFocusableOptionsFromCategorizedOptions - ); buildFocusableOptions = () => - this.buildFocusableOptionsFromCategorizedOptions( - this.buildCategorizedOptions() - ); + buildFocusableOptionsFromCategorizedOptions(this.buildCategorizedOptions()); getFocusableOptions = () => this.props.menuIsOpen ? this.buildFocusableOptions() : [];