From c3a6495eb1abd9727ac8a865091045f0869653be Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 4 Nov 2017 05:36:00 +0200 Subject: [PATCH] Don't load mdi icons with JS - it doesn't do anything. (#546) --- src/home-assistant.html | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/src/home-assistant.html b/src/home-assistant.html index 4e3f1a1299..14a5740ae7 100644 --- a/src/home-assistant.html +++ b/src/home-assistant.html @@ -39,7 +39,7 @@ + show-loading='[[computeShowLoading(connectionPromise, hass)]]'> @@ -72,16 +72,9 @@ class HomeAssistant extends Polymer.Element { type: Object, value: null, }, - icons: { - type: String, - }, - iconsLoaded: { - type: Boolean, - value: false, - }, showMain: { type: Boolean, - computed: 'computeShowMain(hass, iconsLoaded)', + computed: 'computeShowMain(hass)', }, }; } @@ -90,33 +83,16 @@ class HomeAssistant extends Polymer.Element { super.ready(); this.addEventListener('settheme', e => this.setTheme(e)); this.addEventListener('hass-language-select', e => this.selectLanguage(e)); - this.loadIcons(); this.loadResources(); } - computeShowMain(hass, iconsLoaded) { - return hass && hass.states && hass.config && iconsLoaded; + computeShowMain(hass) { + return hass && hass.states && hass.config; } - computeShowLoading(connectionPromise, hass, iconsLoaded) { + computeShowLoading(connectionPromise, hass) { // Show loading when connecting or when connected but not all pieces loaded yet - return (connectionPromise != null || - (hass && (!hass.states || !hass.config || !iconsLoaded))); - } - - loadIcons() { - // If the import fails, we'll try to import again, must be a server glitch - // Since HTML imports only resolve once, in prod mode we import another url. - const success = () => { - this.iconsLoaded = true; - }; - - Polymer.importHref( - '/static/mdi' + this.icons + '.html', - success, - () => Polymer.importHref('/static/mdi.html', success, success), - true /* true for async */ - ); + return (connectionPromise != null || (hass && (!hass.states || !hass.config))); } loadResources() {