Skip to content

Commit d827c50

Browse files
committed
chore: rollback
1 parent 3eb7205 commit d827c50

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Mentions.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { CommonInputProps } from '@rc-component/input/lib/interface';
55
import type { TextAreaProps, TextAreaRef } from '@rc-component/textarea';
66
import TextArea from '@rc-component/textarea';
77
import toArray from '@rc-component/util/lib/Children/toArray';
8+
import useControlledState from '@rc-component/util/lib/hooks/useControlledState';
89
import KeyCode from '@rc-component/util/lib/KeyCode';
910
import React, {
1011
forwardRef,
@@ -29,7 +30,6 @@ import {
2930
setInputSelection,
3031
} from './util';
3132
import { UnstableContext } from './context';
32-
import { useMergedState } from '@rc-component/util';
3333

3434
type BaseTextareaAttrs = Omit<
3535
TextAreaProps,
@@ -171,10 +171,10 @@ const InternalMentions = forwardRef<MentionsRef, MentionsProps>(
171171
const [isFocus, setIsFocus] = useState(false);
172172

173173
// ============================== Value ===============================
174-
const [mergedValue, setMergedValue] = useMergedState('', {
175-
defaultValue,
176-
value: value,
177-
});
174+
const [mergedValue, setMergedValue] = useControlledState(
175+
defaultValue || '',
176+
value,
177+
);
178178

179179
// =============================== Open ===============================
180180
const { open } = useContext(UnstableContext);
@@ -564,10 +564,10 @@ const Mentions = forwardRef<MentionsRef, MentionsProps>(
564564
}));
565565

566566
// ============================== Value ===============================
567-
const [mergedValue, setMergedValue] = useMergedState('', {
568-
defaultValue,
569-
value: customValue,
570-
});
567+
const [mergedValue, setMergedValue] = useControlledState(
568+
defaultValue || '',
569+
customValue,
570+
);
571571

572572
// ============================== Change ==============================
573573
const triggerChange = (currentValue: string) => {

0 commit comments

Comments
 (0)