Skip to content

Commit b7c92b3

Browse files
EmilyyyLiu刘欢
andauthored
fix: Fix search props leaked to DOM (#1157)
* fix: Fix search props leaked to DOM * fix: Remove filterTreeNode and treeNodeFilterProp from OMIT_DOM_PROPS * fix: Transfer search props to useSearchConfig * fix: fix lint error --------- Co-authored-by: 刘欢 <[email protected]>
1 parent 0d1dd21 commit b7c92b3

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/Select.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
195195
fieldNames,
196196
// Search
197197
showSearch,
198+
searchValue: legacySearchValue,
199+
onSearch: legacyOnSearch,
200+
autoClearSearchValue: legacyAutoClearSearchValue,
201+
filterOption: legacyFilterOption,
202+
optionFilterProp: legacyOptionFilterProp,
203+
filterSort: legacyFilterSort,
204+
198205
// Select
199206
onSelect,
200207
onDeselect,
@@ -223,7 +230,15 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
223230
...restProps
224231
} = props;
225232

226-
const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch, props);
233+
const searchProps = {
234+
searchValue: legacySearchValue,
235+
onSearch: legacyOnSearch,
236+
autoClearSearchValue: legacyAutoClearSearchValue,
237+
filterOption: legacyFilterOption,
238+
optionFilterProp: legacyOptionFilterProp,
239+
filterSort: legacyFilterSort,
240+
};
241+
const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch, searchProps);
227242
const {
228243
filterOption,
229244
searchValue,

src/hooks/useSearchConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { SearchConfig, DefaultOptionType, SelectProps } from '@/Select';
1+
import type { SearchConfig, DefaultOptionType } from '@/Select';
22
import * as React from 'react';
33

44
// Convert `showSearch` to unique config
55
export default function useSearchConfig(
66
showSearch: boolean | SearchConfig<DefaultOptionType> | undefined,
7-
props: SelectProps,
7+
props: SearchConfig<DefaultOptionType>,
88
) {
99
const {
1010
filterOption,

0 commit comments

Comments
 (0)