[client-app] re-setup IdentityStore in new window

Summary:
Before this patch, the IdentityStore would initialize in our empty hot
window. However, hot windows don't receive any `action-bridge-message`s,
which include DB updates. Since the hot window loads first, it was with a
stale verison of the Identity. The main window fetches a fresh identity,
but that fresh update failed to get to new composers because the hot
window wasn't listening to changes to the DB.

This makes it such that the IdentityStore properly boots up when the
window props change.

Test Plan: manual

Reviewers: halla, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4327
This commit is contained in:
Evan Morikawa 2017-04-03 16:44:01 -07:00
parent 368201f334
commit 2f082f8beb

View file

@ -22,6 +22,14 @@ class IdentityStore extends NylasStore {
}
async activate() {
if (NylasEnv.isEmptyWindow()) {
NylasEnv.onWindowPropsReceived(() => {
this.deactivate();
this.activate();
})
return
}
NylasEnv.config.onDidChange('env', this._onEnvChanged);
this._onEnvChanged();
@ -37,7 +45,7 @@ class IdentityStore extends NylasStore {
}
deactivate() {
this._disp.dispose();
if (this._disp) this._disp.dispose();
this.stopListeningToAll()
}