mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +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,
|
||||
} = 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;
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user