@@ -63,6 +63,8 @@ export const InputSelect: FC<InputSelectProps> = ({
6363
6464 const [ isAutoFilling , setAutoFilling ] = useState < boolean > ( false ) ;
6565
66+ const lowercaseString : ( value : string | number ) => string = value => `${ value } ` . toLowerCase ( ) ;
67+
6668 const optionMatchesValue = ( option : any , value : any ) => {
6769 // Note: Sometimes we pass in the value as true value and sometimes value is the selected option.
6870 return optionValueKey ? _get ( option , optionValueKey ) === value || _isEqual ( option , value ) : _isEqual ( option , value ) ;
@@ -173,6 +175,8 @@ export const InputSelect: FC<InputSelectProps> = ({
173175 // Note: We had to use a `useEffect` here to handle cases where the form is reset or manipulated outside of the input
174176 // For some reason setting the initialInputValue in the initial useState did not reset the input on a form reset
175177 useEffect ( ( ) => {
178+ if ( _isEqual ( controlledValue , value ) ) return ;
179+
176180 setValue ( controlledValue ) ;
177181 } , [ controlledValue ] ) ;
178182
@@ -298,9 +302,10 @@ export const InputSelect: FC<InputSelectProps> = ({
298302 // Allows the input to keep it's value when the user selects an option when disableCloseOnSelect is true
299303 if ( isMultiselect && autocompleteProps . disableCloseOnSelect ) {
300304 autocompleteProps . inputValue = inputValue ;
305+ const existingOnBlur = autocompleteProps . onBlur ;
301306 autocompleteProps . onBlur = event => {
302- setInputValue ( '' ) ;
303- if ( autocompleteProps . onBlur ) autocompleteProps . onBlur ( event ) ;
307+ if ( inputValue ) setInputValue ( '' ) ;
308+ if ( existingOnBlur ) existingOnBlur ( event ) ;
304309 } ;
305310 }
306311
0 commit comments