File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -13,27 +13,26 @@ export default function useSearchConfig(
13
13
filterSort,
14
14
onSearch,
15
15
autoClearSearchValue,
16
- } = props || { } ;
16
+ } = props ;
17
17
return React . useMemo < [ boolean | undefined , SearchConfig < DefaultOptionType > ] > ( ( ) => {
18
- const legacyShowSearch : SearchConfig < DefaultOptionType > = {
18
+ const searchConfig = {
19
19
filterOption,
20
20
searchValue,
21
21
optionFilterProp,
22
22
filterSort,
23
23
onSearch,
24
24
autoClearSearchValue,
25
+ ...( typeof showSearch === 'object' ? showSearch : { } ) ,
25
26
} ;
26
27
27
- if ( showSearch === undefined || showSearch === true ) {
28
- return [ showSearch as undefined | boolean , legacyShowSearch ] ;
29
- }
30
- if ( ! showSearch ) {
28
+ if ( showSearch === false ) {
31
29
return [ false , { } ] ;
32
30
}
33
- const searchConfig = {
34
- ...legacyShowSearch ,
35
- ...showSearch ,
36
- } ;
31
+
32
+ if ( showSearch === undefined ) {
33
+ return [ undefined , searchConfig ] ;
34
+ }
35
+
37
36
return [ true , searchConfig ] ;
38
37
} , [
39
38
showSearch ,
You can’t perform that action at this time.
0 commit comments