mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-25 00:25:03 +08:00
[client-sync] Ensure allmail folder exists before trying to access it
Summary: When checking for flag updates for gmail accounts, when syncing for the first time the all mail folder won't be available because we haven't fetched the folder list, so it will throw a runtime error Test Plan: manual Reviewers: mark, halla Reviewed By: halla Differential Revision: https://phab.nylas.com/D4405
This commit is contained in:
parent
d226eaf4a7
commit
0525767518
1 changed files with 5 additions and 3 deletions
|
@ -293,9 +293,11 @@ class SyncWorker {
|
|||
if (this._account.provider === "gmail") {
|
||||
const checkForAttributeUpdates = async () => {
|
||||
const allMailFolder = await this._db.Folder.findOne({where: {role: 'all'}})
|
||||
const allMailBox = await this._mailListenerIMAPConn.getLatestBoxStatus(allMailFolder.name)
|
||||
if (allMailFolder.syncState.highestmodseq !== allMailBox.highestmodseq) {
|
||||
onUpdate();
|
||||
if (allMailFolder) {
|
||||
const allMailBox = await this._mailListenerIMAPConn.getLatestBoxStatus(allMailFolder.name)
|
||||
if (allMailFolder.syncState.highestmodseq !== allMailBox.highestmodseq) {
|
||||
onUpdate();
|
||||
}
|
||||
}
|
||||
this._mailListenerAttrPollTimeout = setTimeout(checkForAttributeUpdates, 30 * 1000)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue