From ad50fdeaf011683ccc36dd2f86aba3645e55a708 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Sat, 15 Apr 2017 18:37:57 -0700 Subject: [PATCH] [client-app] When resetting database, make sure to re-init db reader Summary: see title Test Plan: manual Reviewers: halla, mark, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D4432 --- packages/client-app/src/browser/application.es6 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/client-app/src/browser/application.es6 b/packages/client-app/src/browser/application.es6 index 6badab61ab..b1ee32a6bb 100644 --- a/packages/client-app/src/browser/application.es6 +++ b/packages/client-app/src/browser/application.es6 @@ -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); @@ -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(); });