Dont show config changes when user saved it (#8520)

This commit is contained in:
Bram Kragten 2021-03-02 21:43:45 +01:00 committed by GitHub
parent 33cbf7eabe
commit 0a3505ed89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,7 @@ class LovelaceFullConfigEditor extends LitElement {
</div> </div>
<mwc-button <mwc-button
raised raised
@click="${this._handleSave}" @click=${this._handleSave}
.disabled=${!this._changed} .disabled=${!this._changed}
>${this.hass!.localize( >${this.hass!.localize(
"ui.panel.lovelace.editor.raw_editor.save" "ui.panel.lovelace.editor.raw_editor.save"
@ -95,8 +95,8 @@ class LovelaceFullConfigEditor extends LitElement {
autofocus autofocus
.rtl=${computeRTL(this.hass)} .rtl=${computeRTL(this.hass)}
.hass=${this.hass} .hass=${this.hass}
@value-changed="${this._yamlChanged}" @value-changed=${this._yamlChanged}
@editor-save="${this._handleSave}" @editor-save=${this._handleSave}
> >
</ha-code-editor> </ha-code-editor>
</div> </div>
@ -112,6 +112,7 @@ class LovelaceFullConfigEditor extends LitElement {
protected updated(changedProps: PropertyValues) { protected updated(changedProps: PropertyValues) {
const oldLovelace = changedProps.get("lovelace") as Lovelace | undefined; const oldLovelace = changedProps.get("lovelace") as Lovelace | undefined;
if ( if (
!this._saving &&
oldLovelace && oldLovelace &&
this.lovelace && this.lovelace &&
oldLovelace.config !== this.lovelace.config && oldLovelace.config !== this.lovelace.config &&
@ -305,8 +306,8 @@ class LovelaceFullConfigEditor extends LitElement {
}); });
} }
window.onbeforeunload = null; window.onbeforeunload = null;
this._saving = false;
this._changed = false; this._changed = false;
this._saving = false;
} }
private get yamlEditor(): HaCodeEditor { private get yamlEditor(): HaCodeEditor {