mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
Fix saving Lovelace config (#9041)
This commit is contained in:
parent
65a30bf60c
commit
542f169b36
@ -363,11 +363,22 @@ class LovelacePanel extends LitElement {
|
|||||||
mode: previousMode,
|
mode: previousMode,
|
||||||
} = this.lovelace!;
|
} = this.lovelace!;
|
||||||
newConfig = this._checkLovelaceConfig(newConfig);
|
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 {
|
try {
|
||||||
// Optimistic update
|
// Optimistic update
|
||||||
this._updateLovelace({
|
this._updateLovelace({
|
||||||
config: newConfig,
|
config: conf,
|
||||||
rawConfig: undefined,
|
rawConfig: newConfig,
|
||||||
mode: "storage",
|
mode: "storage",
|
||||||
});
|
});
|
||||||
this._ignoreNextUpdateEvent = true;
|
this._ignoreNextUpdateEvent = true;
|
||||||
|
@ -115,8 +115,8 @@ class LovelaceFullConfigEditor extends LitElement {
|
|||||||
!this._saving &&
|
!this._saving &&
|
||||||
oldLovelace &&
|
oldLovelace &&
|
||||||
this.lovelace &&
|
this.lovelace &&
|
||||||
oldLovelace.config !== this.lovelace.config &&
|
oldLovelace.rawConfig !== this.lovelace.rawConfig &&
|
||||||
!deepEqual(oldLovelace.config, this.lovelace.config)
|
!deepEqual(oldLovelace.rawConfig, this.lovelace.rawConfig)
|
||||||
) {
|
) {
|
||||||
showToast(this, {
|
showToast(this, {
|
||||||
message: this.hass!.localize(
|
message: this.hass!.localize(
|
||||||
@ -124,7 +124,7 @@ class LovelaceFullConfigEditor extends LitElement {
|
|||||||
),
|
),
|
||||||
action: {
|
action: {
|
||||||
action: () => {
|
action: () => {
|
||||||
this.yamlEditor.value = safeDump(this.lovelace!.config);
|
this.yamlEditor.value = safeDump(this.lovelace!.rawConfig);
|
||||||
},
|
},
|
||||||
text: this.hass!.localize(
|
text: this.hass!.localize(
|
||||||
"ui.panel.lovelace.editor.raw_editor.reload"
|
"ui.panel.lovelace.editor.raw_editor.reload"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user