|
29 | 29 | * - `combobox` mode not support `optionLabelProp`
|
30 | 30 | */
|
31 | 31 |
|
32 |
| -import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; |
| 32 | +import useControlledState from '@rc-component/util/lib/hooks/useControlledState'; |
33 | 33 | import warning from '@rc-component/util/lib/warning';
|
34 | 34 | import * as React from 'react';
|
35 | 35 | import type {
|
@@ -272,10 +272,8 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
|
272 | 272 | );
|
273 | 273 |
|
274 | 274 | // =========================== Search ===========================
|
275 |
| - const [mergedSearchValue, setSearchValue] = useMergedState('', { |
276 |
| - value: searchValue, |
277 |
| - postState: (search) => search || '', |
278 |
| - }); |
| 275 | + const [internalSearchValue, setSearchValue] = useControlledState('', searchValue); |
| 276 | + const mergedSearchValue = internalSearchValue || ''; |
279 | 277 |
|
280 | 278 | // =========================== Option ===========================
|
281 | 279 | const parsedOptions = useOptions(
|
@@ -343,9 +341,7 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
|
343 | 341 | );
|
344 | 342 |
|
345 | 343 | // =========================== Values ===========================
|
346 |
| - const [internalValue, setInternalValue] = useMergedState(defaultValue, { |
347 |
| - value, |
348 |
| - }); |
| 344 | + const [internalValue, setInternalValue] = useControlledState(defaultValue, value); |
349 | 345 |
|
350 | 346 | // Merged value with LabelValueType
|
351 | 347 | const rawLabeledValues = React.useMemo(() => {
|
|
0 commit comments