77 useCombobox ,
88 useMultipleSelection
99} from "downshift" ;
10- import { useCallback , useMemo , useRef , useEffect } from "react" ;
10+ import { useCallback , useMemo } from "react" ;
1111import { A11yStatusMessage , MultiSelector } from "../helpers/types" ;
1212
1313export type UseDownshiftMultiSelectPropsReturnValue = UseMultipleSelectionReturnValue < string > &
@@ -37,12 +37,6 @@ export function useDownshiftMultiSelectProps(
3737 options : Options ,
3838 a11yStatusMessage : A11yStatusMessage
3939) : UseDownshiftMultiSelectPropsReturnValue {
40- const isInitializing = useRef ( true ) ;
41-
42- useEffect ( ( ) => {
43- isInitializing . current = false ;
44- } , [ ] ) ;
45-
4640 const {
4741 getSelectedItemProps,
4842 getDropdownProps,
@@ -97,7 +91,6 @@ export function useDownshiftMultiSelectProps(
9791 removeSelectedItem ,
9892 setSelectedItems ,
9993 a11yStatusMessage ,
100- isInitializing ,
10194 options
10295 )
10396 ) ;
@@ -147,7 +140,6 @@ function useComboboxProps(
147140 removeSelectedItem : ( item : string ) => void ,
148141 setSelectedItems : ( item : string [ ] ) => void ,
149142 a11yStatusMessage : A11yStatusMessage ,
150- isInitializing : React . MutableRefObject < boolean > ,
151143 options ?: Options
152144) : UseComboboxProps < string > {
153145 return useMemo ( ( ) => {
@@ -156,13 +148,9 @@ function useComboboxProps(
156148 selectedItem : null ,
157149 inputId : options ?. inputId ,
158150 labelId : options ?. labelId ,
159- onInputValueChange ( { inputValue, type } ) {
151+ onInputValueChange ( { inputValue } ) {
160152 selector . options . setSearchTerm ( inputValue ! ) ;
161- if (
162- ! isInitializing . current &&
163- type === useCombobox . stateChangeTypes . InputChange &&
164- selector . onFilterInputChange
165- ) {
153+ if ( selector . onFilterInputChange ) {
166154 selector . onFilterInputChange ( inputValue ) ;
167155 }
168156 } ,
0 commit comments