CompositionArea: Don't unconditionally apply draft contents if empty
This commit is contained in:
parent
cdc68d1c34
commit
f93b4235d5
4 changed files with 17 additions and 12 deletions
|
@ -372,14 +372,23 @@ export function CompositionArea({
|
|||
messageCompositionId,
|
||||
messageCompositionId
|
||||
);
|
||||
const previousSendCounter = usePrevious(sendCounter, sendCounter);
|
||||
useEffect(() => {
|
||||
if (!inputApiRef.current) {
|
||||
return;
|
||||
}
|
||||
if (previousMessageCompositionId !== messageCompositionId) {
|
||||
if (
|
||||
previousMessageCompositionId !== messageCompositionId ||
|
||||
previousSendCounter !== sendCounter
|
||||
) {
|
||||
inputApiRef.current.reset();
|
||||
}
|
||||
}, [messageCompositionId, previousMessageCompositionId]);
|
||||
}, [
|
||||
messageCompositionId,
|
||||
sendCounter,
|
||||
previousMessageCompositionId,
|
||||
previousSendCounter,
|
||||
]);
|
||||
|
||||
const insertEmoji = useCallback(
|
||||
(e: EmojiPickDataType) => {
|
||||
|
@ -393,12 +402,12 @@ export function CompositionArea({
|
|||
|
||||
const previousConversationId = usePrevious(conversationId, conversationId);
|
||||
useEffect(() => {
|
||||
if (!draftText) {
|
||||
inputApiRef.current?.setContents('');
|
||||
if (conversationId === previousConversationId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (conversationId === previousConversationId) {
|
||||
if (!draftText) {
|
||||
inputApiRef.current?.setContents('');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue