From 190911b2618052d56e32150b6c557b7a4f4b70e7 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 17 Dec 2015 19:41:26 -0800 Subject: [PATCH] Delay removing of init skeleton. --- src/home-assistant.js | 6 ------ src/layouts/home-assistant-main.js | 2 ++ src/layouts/login-form.js | 5 +++++ src/util/remove-init-message.js | 7 +++++++ 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 src/util/remove-init-message.js diff --git a/src/home-assistant.js b/src/home-assistant.js index 4d735f2ecd..282d15d678 100644 --- a/src/home-assistant.js +++ b/src/home-assistant.js @@ -68,12 +68,6 @@ export default new Polymer({ this.registerServiceWorker(); }, - attached() { - // remove the HTML init message - const initMsg = document.getElementById('init'); - initMsg.parentElement.removeChild(initMsg); - }, - ready() { reactor.batch(() => { // if auth was given, tell the backend diff --git a/src/layouts/home-assistant-main.js b/src/layouts/home-assistant-main.js index 8408cbf967..84b1b1bb17 100644 --- a/src/layouts/home-assistant-main.js +++ b/src/layouts/home-assistant-main.js @@ -2,6 +2,7 @@ import Polymer from '../polymer'; import hass from '../util/home-assistant-js-instance'; import nuclearObserver from '../util/bound-nuclear-behavior'; +import removeInitMsg from '../util/remove-init-message'; require('../components/ha-sidebar'); require('../layouts/partial-zone'); @@ -113,6 +114,7 @@ export default new Polymer({ }, attached() { + removeInitMsg(); startUrlSync(); }, diff --git a/src/layouts/login-form.js b/src/layouts/login-form.js index 439dc31d24..a6981f175b 100644 --- a/src/layouts/login-form.js +++ b/src/layouts/login-form.js @@ -4,6 +4,7 @@ import hass from '../util/home-assistant-js-instance'; import nuclearObserver from '../util/bound-nuclear-behavior'; import validateAuth from '../util/validate-auth'; +import removeInitMsg from '../util/remove-init-message'; const { authGetters } = hass; @@ -54,6 +55,10 @@ export default new Polymer({ 'validatingChanged(isValidating, isInvalid)', ], + attached() { + removeInitMsg(); + }, + computeShowSpinner(forceShowLoading, isValidating) { return forceShowLoading || isValidating; }, diff --git a/src/util/remove-init-message.js b/src/util/remove-init-message.js new file mode 100644 index 0000000000..2c80816fb4 --- /dev/null +++ b/src/util/remove-init-message.js @@ -0,0 +1,7 @@ +export default function removeInitMessage() { + // remove the HTML init message + const initMsg = document.getElementById('ha-init-skeleton'); + if (initMsg) { + initMsg.parentElement.removeChild(initMsg); + } +}