mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-10 17:48:50 +08:00
Fix exception thrown when rapidly clicking Trash icon
This commit is contained in:
parent
e0260c0f1a
commit
156b7cb615
2 changed files with 5 additions and 2 deletions
|
@ -206,7 +206,7 @@ class DraftFactory
|
|||
else if behavior is 'prefer-existing-if-pristine'
|
||||
DraftStore ?= require('./draft-store').default
|
||||
return Promise.all(candidateDrafts.map (candidateDraft) =>
|
||||
DraftStore.sessionForId(candidateDraft.id)
|
||||
DraftStore.sessionForClientId(candidateDraft.headerMessageId)
|
||||
).then (sessions) =>
|
||||
for session in sessions
|
||||
if session.draft().pristine
|
||||
|
|
|
@ -107,6 +107,9 @@ class DraftStore extends MailspringStore {
|
|||
// window.close() within on onbeforeunload could do weird things.
|
||||
Object.values(this._draftSessions).forEach(session => {
|
||||
const draft = session.draft();
|
||||
if (!draft.id) {
|
||||
return;
|
||||
}
|
||||
if (draft && draft.pristine) {
|
||||
Actions.queueTask(
|
||||
new DestroyDraftTask({
|
||||
|
@ -228,7 +231,7 @@ class DraftStore extends MailspringStore {
|
|||
queries.message = DatabaseStore.findAll(Message, { threadId: threadId || thread.id })
|
||||
.order(Message.attributes.date.descending())
|
||||
.include(Message.attributes.body)
|
||||
.limit(5)
|
||||
.limit(10)
|
||||
.then(messages => messages.find(m => !m.isHidden()));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue