77 useCombobox
88} from "downshift" ;
99
10- import { useCallback , useMemo , useRef , useEffect } from "react" ;
10+ import { useCallback , useMemo } from "react" ;
1111import { A11yStatusMessage , SingleSelector } from "../helpers/types" ;
1212
1313interface Options {
@@ -21,11 +21,6 @@ export function useDownshiftSingleSelectProps(
2121 a11yStatusMessage : A11yStatusMessage
2222) : UseComboboxReturnValue < string > {
2323 const { inputId, labelId } = options ;
24- const isInitializing = useRef ( true ) ;
25-
26- useEffect ( ( ) => {
27- isInitializing . current = false ;
28- } , [ ] ) ;
2924
3025 const downshiftProps : UseComboboxProps < string > = useMemo ( ( ) => {
3126 return {
@@ -34,13 +29,9 @@ export function useDownshiftSingleSelectProps(
3429 onSelectedItemChange ( { selectedItem } : UseComboboxStateChange < string > ) {
3530 selector . setValue ( selectedItem ?? null ) ;
3631 } ,
37- onInputValueChange ( { inputValue, type } ) {
32+ onInputValueChange ( { inputValue } ) {
3833 selector . options . setSearchTerm ( inputValue ! ) ;
39- if (
40- ! isInitializing . current &&
41- type === useCombobox . stateChangeTypes . InputChange &&
42- selector . onFilterInputChange
43- ) {
34+ if ( selector . onFilterInputChange ) {
4435 selector . onFilterInputChange ( inputValue ! ) ;
4536 }
4637 } ,
0 commit comments