New attempts to minimize the problems in #17

This commit is contained in:
Thomas Lovén 2019-04-01 22:49:12 +02:00
parent d4acb7de58
commit 4d3408560d

View File

@ -16,6 +16,7 @@ class LayoutCard extends cardTools.LitElement {
window.addEventListener('resize', () => this.build());
window.addEventListener('hass-open-menu', () => setTimeout(() => this.build(), 100));
window.addEventListener('hass-close-menu', () => setTimeout(() => this.build(), 100));
window.addEventListener('location-changed', () => setTimeout(() => this.build(), 100));
if(config.rebuild)
window.setTimeout(() => this.build(), config.rebuild);
}
@ -88,6 +89,7 @@ class LayoutCard extends cardTools.LitElement {
}
build() {
if (this.offsetParent === null) return;
const root = this.shadowRoot.querySelector("#columns");
while(root.lastChild) {
root.removeChild(root.lastChild);