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(
1313 filterSort,
1414 onSearch,
1515 autoClearSearchValue,
16- } = props || { } ;
16+ } = props ;
1717 return React . useMemo < [ boolean | undefined , SearchConfig < DefaultOptionType > ] > ( ( ) => {
18- const legacyShowSearch : SearchConfig < DefaultOptionType > = {
18+ const searchConfig = {
1919 filterOption,
2020 searchValue,
2121 optionFilterProp,
2222 filterSort,
2323 onSearch,
2424 autoClearSearchValue,
25+ ...( typeof showSearch === 'object' ? showSearch : { } ) ,
2526 } ;
2627
27- if ( showSearch === undefined || showSearch === true ) {
28- return [ showSearch as undefined | boolean , legacyShowSearch ] ;
29- }
30- if ( ! showSearch ) {
28+ if ( showSearch === false ) {
3129 return [ false , { } ] ;
3230 }
33- const searchConfig = {
34- ...legacyShowSearch ,
35- ...showSearch ,
36- } ;
31+
32+ if ( showSearch === undefined ) {
33+ return [ undefined , searchConfig ] ;
34+ }
35+
3736 return [ true , searchConfig ] ;
3837 } , [
3938 showSearch ,
You can’t perform that action at this time.
0 commit comments