mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-26 00:54:04 +08:00
[client-app] Don't try to restart sync on every IdentityStore change
Summary: The IdentityStore can trigger any number of times, but we only want to start sync if we previously didn't have an identity available Test Plan: manual Reviewers: spang, evan, halla Reviewed By: evan, halla Differential Revision: https://phab.nylas.com/D4246
This commit is contained in:
parent
43738771ac
commit
41ad424752
1 changed files with 7 additions and 1 deletions
|
@ -10,6 +10,7 @@ class SyncProcessManager {
|
|||
constructor() {
|
||||
this._exiting = false;
|
||||
this._resettingEmailCache = false
|
||||
this._identityId = null;
|
||||
this._workersByAccountId = {};
|
||||
this._localSyncDeltaEmittersByAccountId = new Map()
|
||||
|
||||
|
@ -32,7 +33,12 @@ class SyncProcessManager {
|
|||
}
|
||||
|
||||
_onIdentityChanged() {
|
||||
if (IdentityStore.identity()) {
|
||||
this._identityId = IdentityStore.identity()
|
||||
const newIdentityId = IdentityStore.identityId()
|
||||
if (newIdentityId !== this._identityId) {
|
||||
// The IdentityStore can trigger any number of times, but we only want to
|
||||
// start sync if we previously didn't have an identity available
|
||||
this._identityId = newIdentityId
|
||||
this.start()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue