diff --git a/src/panels/lovelace/ha-panel-lovelace.ts b/src/panels/lovelace/ha-panel-lovelace.ts index a499aa54e0..43aa5c8d45 100644 --- a/src/panels/lovelace/ha-panel-lovelace.ts +++ b/src/panels/lovelace/ha-panel-lovelace.ts @@ -363,11 +363,22 @@ class LovelacePanel extends LitElement { mode: previousMode, } = this.lovelace!; newConfig = this._checkLovelaceConfig(newConfig); + let conf: LovelaceConfig; + // If strategy defined, apply it here. + if (newConfig.strategy) { + conf = await generateLovelaceDashboardStrategy({ + config: newConfig, + hass: this.hass!, + narrow: this.narrow, + }); + } else { + conf = newConfig; + } try { // Optimistic update this._updateLovelace({ - config: newConfig, - rawConfig: undefined, + config: conf, + rawConfig: newConfig, mode: "storage", }); this._ignoreNextUpdateEvent = true; diff --git a/src/panels/lovelace/hui-editor.ts b/src/panels/lovelace/hui-editor.ts index eb0a8805e7..6e86102452 100644 --- a/src/panels/lovelace/hui-editor.ts +++ b/src/panels/lovelace/hui-editor.ts @@ -115,8 +115,8 @@ class LovelaceFullConfigEditor extends LitElement { !this._saving && oldLovelace && this.lovelace && - oldLovelace.config !== this.lovelace.config && - !deepEqual(oldLovelace.config, this.lovelace.config) + oldLovelace.rawConfig !== this.lovelace.rawConfig && + !deepEqual(oldLovelace.rawConfig, this.lovelace.rawConfig) ) { showToast(this, { message: this.hass!.localize( @@ -124,7 +124,7 @@ class LovelaceFullConfigEditor extends LitElement { ), action: { action: () => { - this.yamlEditor.value = safeDump(this.lovelace!.config); + this.yamlEditor.value = safeDump(this.lovelace!.rawConfig); }, text: this.hass!.localize( "ui.panel.lovelace.editor.raw_editor.reload"