Skip to content

Commit

Permalink
[client-app] When resetting database, make sure to re-init db reader
Browse files Browse the repository at this point in the history
Summary: see title

Test Plan: manual

Reviewers: halla, mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4432
  • Loading branch information
jstejada committed Apr 17, 2017
1 parent 26868f6 commit ad50fde
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/client-app/src/browser/application.es6
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,11 @@ export default class Application extends EventEmitter {
fn = this._deleteDatabase;
}

fn(() => {
this.databaseReader = new DatabaseReader({configDirPath: this.configDirPath, specMode: this.specMode});
fn(async () => {
if (resetDatabase) {
this.databaseReader = new DatabaseReader({configDirPath: this.configDirPath, specMode: this.specMode});
await this.databaseReader.open()
}
if (resetConfig) {
this.config.set('nylas', null);
this.config.set('edgehill', null);
Expand Down Expand Up @@ -259,8 +262,9 @@ export default class Application extends EventEmitter {
}
this.setDatabasePhase('close');
this.windowManager.destroyAllWindows();
this._deleteDatabase(() => {
this._deleteDatabase(async () => {
this.databaseReader = new DatabaseReader({configDirPath: this.configDirPath, specMode: this.specMode});
await this.databaseReader.open()
this.setDatabasePhase('setup');
this.openWindowsForTokenState();
});
Expand Down

0 comments on commit ad50fde

Please sign in to comment.