Prevent identity token from briefly being null while retriving new value

This commit is contained in:
Ben Gotow 2017-11-10 14:14:23 +01:00
parent 2af2e1982b
commit 7e81c3154e

View file

@ -96,8 +96,9 @@ class IdentityStore extends MailspringStore {
* cache and set the token from the keychain.
*/
_onIdentityChanged = async () => {
this._identity = AppEnv.config.get('identity') || {};
this._identity.token = await KeyManager.getPassword(KEYCHAIN_NAME);
const next = Object.assign({}, AppEnv.config.get('identity') || {});
next.token = await KeyManager.getPassword(KEYCHAIN_NAME);
this._identity = next;
this.trigger();
};