7
7
useCombobox
8
8
} from "downshift" ;
9
9
10
- import { useCallback , useMemo , useRef , useEffect } from "react" ;
10
+ import { useCallback , useMemo } from "react" ;
11
11
import { A11yStatusMessage , SingleSelector } from "../helpers/types" ;
12
12
13
13
interface Options {
@@ -21,11 +21,6 @@ export function useDownshiftSingleSelectProps(
21
21
a11yStatusMessage : A11yStatusMessage
22
22
) : UseComboboxReturnValue < string > {
23
23
const { inputId, labelId } = options ;
24
- const isInitializing = useRef ( true ) ;
25
-
26
- useEffect ( ( ) => {
27
- isInitializing . current = false ;
28
- } , [ ] ) ;
29
24
30
25
const downshiftProps : UseComboboxProps < string > = useMemo ( ( ) => {
31
26
return {
@@ -34,13 +29,9 @@ export function useDownshiftSingleSelectProps(
34
29
onSelectedItemChange ( { selectedItem } : UseComboboxStateChange < string > ) {
35
30
selector . setValue ( selectedItem ?? null ) ;
36
31
} ,
37
- onInputValueChange ( { inputValue, type } ) {
32
+ onInputValueChange ( { inputValue } ) {
38
33
selector . options . setSearchTerm ( inputValue ! ) ;
39
- if (
40
- ! isInitializing . current &&
41
- type === useCombobox . stateChangeTypes . InputChange &&
42
- selector . onFilterInputChange
43
- ) {
34
+ if ( selector . onFilterInputChange ) {
44
35
selector . onFilterInputChange ( inputValue ! ) ;
45
36
}
46
37
} ,
0 commit comments