From 5adf6af55e688d09491dbcda146d496ec8fe9bf3 Mon Sep 17 00:00:00 2001 From: Dan Esparza Date: Thu, 19 Oct 2017 20:21:27 -0400 Subject: [PATCH] Add better defaults for first time users --- src/stores/SettingsStore.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 1914f8a..d64b9c2 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js @@ -86,18 +86,20 @@ class SettingsStore extends Store { switch (action.actionType) { case ActionTypes.RECEIVE_SERVER_LIST: - this.serverList = action.servers; - console.log(action); + this.serverList = action.servers || []; + console.log("Server list", this.serverList); // If this list is now blank, we should reset // current database // list of databases // current server - if(this.serverList.length < 1){ - this.currentDatabase = ""; - this.currentServerDBList = []; - this.currentServer = {}; - } + try{ + if(this.serverList.length < 1){ + this.currentDatabase = ""; + this.currentServerDBList = []; + this.currentServer = {}; + } + } catch(e) { /* No op */} this.__emitChange(); break; @@ -112,7 +114,7 @@ class SettingsStore extends Store { }); } catch(e) { /* No op */ } - console.log(action); + console.log("Current server: ", this.getCurrentServer()); this.__emitChange(); break; @@ -120,7 +122,7 @@ class SettingsStore extends Store { case ActionTypes.RECEIVE_CURRENT_DATABASE: this.currentDatabase = action.database; - console.log(action); + console.log("Current database: ", this.currentDatabase); this.__emitChange(); break;