From ef2eb004f487576a25a2e017c61ed51314c8bb65 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 17 Jul 2015 23:30:43 -0700 Subject: [PATCH] More info cleanup --- src/dialogs/more-info-dialog.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/dialogs/more-info-dialog.js b/src/dialogs/more-info-dialog.js index 2084939381..b4ee82b920 100644 --- a/src/dialogs/more-info-dialog.js +++ b/src/dialogs/more-info-dialog.js @@ -70,14 +70,6 @@ export default Polymer({ this.shouldFetchHistory) { entityHistoryActions.fetchRecent(this.stateObj.entityId); } - if(this.stateObj) { - if(DOMAINS_WITH_NO_HISTORY.indexOf(this.stateObj.domain) !== -1) { - this.showHistoryComponent = false; - } - else { - this.showHistoryComponent = this.hasHistoryComponent; - } - } }, stateObjChanged(newVal) { @@ -86,15 +78,22 @@ export default Polymer({ return; } - this.fetchHistoryData(); + this.showHistoryComponent = ( + DOMAINS_WITH_NO_HISTORY.indexOf(this.stateObj.domain) === -1 && + this.hasHistoryComponent + ); - // allow dialog to render content before showing it so it is - // positioned correctly. - this.async(() => this.dialogOpen = true, 10); + this.async(() => { + // Firing action while other action is happening confuses nuclear + this.fetchHistoryData(); + // allow dialog to render content before showing it so it is + // positioned correctly. + this.dialogOpen = true + }, 10); }, dialogOpenChanged(newVal) { - if (!newVal) { + if (!newVal && this.stateObj) { moreInfoActions.deselectEntity(); } },