Ensure multiple draft attachment adds don't stomp on each other

This commit is contained in:
Scott Nonnenberg 2021-11-03 18:38:46 -07:00 committed by GitHub
parent c822c45310
commit 4b6832bba5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 3 deletions

View file

@ -8,6 +8,7 @@ import {
} from './processAttachment';
import type { AttachmentType } from '../types/Attachment';
import { AttachmentToastType } from '../types/AttachmentToastType';
import * as log from '../logging/log';
export type AddAttachmentActionType = (
conversationId: string,
@ -74,6 +75,10 @@ export async function handleAttachmentsProcessing({
}
addAttachment(conversationId, attachment);
} catch (err) {
log.error(
'handleAttachmentsProcessing: failed to process attachment:',
err.stack
);
removeAttachment(conversationId, file.path);
onShowToast(AttachmentToastType.ToastUnableToLoadAttachment);
}