Wait for draft changes to be saved before clearing change set

This commit is contained in:
Ben Gotow 2017-09-27 10:28:47 -07:00
parent 941cb45cb6
commit f15ba78cc5
3 changed files with 5 additions and 4 deletions

View file

@ -594,8 +594,7 @@ export default class ComposerView extends React.Component {
};
_onDestroyDraft = () => {
const { draft } = this.props;
Actions.destroyDraft(draft);
Actions.destroyDraft(this.props.draft);
};
_onSelectAttachment = () => {

View file

@ -390,7 +390,9 @@ export default class DraftEditingSession extends MailspringStore {
// by creating a new draft
const baseDraft = draft || inMemoryDraft;
const updatedDraft = this.changes.applyToModel(baseDraft);
Actions.queueTask(new SyncbackDraftTask({ draft: updatedDraft }));
const task = new SyncbackDraftTask({ draft: updatedDraft });
Actions.queueTask(task);
await TaskQueue.waitForPerformLocal(task);
}
// Undo / Redo

View file

@ -110,8 +110,8 @@ class DraftStore extends MailspringStore {
if (draft && draft.pristine) {
Actions.queueTask(
new DestroyDraftTask({
messageIds: [draft.id],
accountId: draft.accountId,
messageIds: [draft.headerMessageId],
})
);
} else {