From 25721d514edc728807e53a06ecf6d06f49c6146e Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 31 Jul 2025 00:53:19 +0200 Subject: [PATCH] Draft: Fix `clearDraft` (#6094) --- src/global/actions/api/messages.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/global/actions/api/messages.ts b/src/global/actions/api/messages.ts index 7eb8cba96..52e1546af 100644 --- a/src/global/actions/api/messages.ts +++ b/src/global/actions/api/messages.ts @@ -684,10 +684,11 @@ addActionHandler('clearDraft', (global, actions, payload): ActionReturnType => { const currentReplyInfo = currentDraft.replyInfo; - const newDraft: ApiDraft | undefined = (shouldKeepReply || shouldKeepSuggestedPost) ? { - replyInfo: shouldKeepReply ? currentReplyInfo : undefined, - suggestedPostInfo: shouldKeepSuggestedPost ? currentDraft.suggestedPostInfo : undefined, - } : undefined; + const newDraft: ApiDraft | undefined = (shouldKeepReply && currentReplyInfo) + || (shouldKeepSuggestedPost && currentDraft.suggestedPostInfo) ? { + replyInfo: shouldKeepReply ? currentReplyInfo : undefined, + suggestedPostInfo: shouldKeepSuggestedPost ? currentDraft.suggestedPostInfo : undefined, + } : undefined; saveDraft({ global, chatId, threadId, draft: newDraft, isLocalOnly,