From ef7d2aea8db711d4a515f37ae510d25540e86ab4 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Thu, 14 Jan 2021 12:52:58 +0100 Subject: [PATCH] Fix config update handling for map card editor (#8115) --- .../components/hui-input-list-editor.ts | 14 ++-- .../config-elements/hui-map-card-editor.ts | 71 ++++++++++--------- 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/src/panels/lovelace/components/hui-input-list-editor.ts b/src/panels/lovelace/components/hui-input-list-editor.ts index d80c2bd989..3d4ba45150 100644 --- a/src/panels/lovelace/components/hui-input-list-editor.ts +++ b/src/panels/lovelace/components/hui-input-list-editor.ts @@ -31,17 +31,17 @@ export class HuiInputListEditor extends LitElement { return html` Clear @@ -49,7 +49,7 @@ export class HuiInputListEditor extends LitElement { })} `; } diff --git a/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts index ff7d92d3ab..714dc8deb1 100644 --- a/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts @@ -96,36 +96,39 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor { return html`
@@ -136,27 +139,28 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor { .dir=${computeRTLDirection(this.hass)} >

${this.hass.localize( @@ -169,9 +173,9 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor { "ui.panel.lovelace.editor.card.map.source" )} .hass=${this.hass} - .value="${this._geo_location_sources}" - .configValue="${"geo_location_sources"}" - @value-changed="${this._valueChanged}" + .value=${this._geo_location_sources} + .configValue=${"geo_location_sources"} + @value-changed=${this._valueChanged} >

@@ -195,14 +199,15 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor { return; } const target = ev.target! as EditorTarget; - if (target.configValue && this[`_${target.configValue}`] === target.value) { + let value = ev.detail.value; + + if (target.configValue && this[`_${target.configValue}`] === value) { return; } - let value: any = target.value; if (target.type === "number") { value = Number(value); } - if (target.value === "" || (target.type === "number" && isNaN(value))) { + if (value === "" || (target.type === "number" && isNaN(value))) { this._config = { ...this._config }; delete this._config[target.configValue!]; } else if (target.configValue) {