Better draft attachment management logic

This commit is contained in:
Fedor Indutny 2025-09-25 14:36:47 -07:00 committed by GitHub
commit 32f65e86a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 21 deletions

View file

@ -180,7 +180,10 @@ export type OwnProps = Readonly<{
quotedMessageAuthorAci: AciString | null;
quotedMessageSentAt: number | null;
removeAttachment: (conversationId: string, filePath: string) => unknown;
removeAttachment: (
conversationId: string,
attachment: AttachmentDraftType
) => unknown;
scrollToMessage: (conversationId: string, messageId: string) => unknown;
setComposerFocus: (conversationId: string) => unknown;
setMessageToEdit(conversationId: string, messageId: string): unknown;
@ -1172,9 +1175,7 @@ export const CompositionArea = memo(function CompositionArea({
onClickAttachment={maybeEditAttachment}
onClose={() => onClearAttachments(conversationId)}
onCloseAttachment={attachment => {
if (attachment.path) {
removeAttachment(conversationId, attachment.path);
}
removeAttachment(conversationId, attachment);
}}
/>
</div>