mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Fix race in lovelace (#19609)
This commit is contained in:
parent
69f2566526
commit
28a0d216f9
@ -73,6 +73,8 @@ export class LovelacePanel extends LitElement {
|
||||
|
||||
private _unsubUpdates?: Promise<UnsubscribeFunc>;
|
||||
|
||||
private _loading = false;
|
||||
|
||||
public connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
if (
|
||||
@ -162,7 +164,7 @@ export class LovelacePanel extends LitElement {
|
||||
|
||||
protected willUpdate(changedProps: PropertyValues) {
|
||||
super.willUpdate(changedProps);
|
||||
if (!this.lovelace && this._panelState !== "error") {
|
||||
if (!this.lovelace && this._panelState !== "error" && !this._loading) {
|
||||
this._fetchConfig(false);
|
||||
}
|
||||
}
|
||||
@ -233,6 +235,8 @@ export class LovelacePanel extends LitElement {
|
||||
}
|
||||
|
||||
private async _fetchConfig(forceDiskRefresh: boolean) {
|
||||
this._loading = true;
|
||||
|
||||
let conf: LovelaceConfig;
|
||||
let rawConf: LovelaceRawConfig | undefined;
|
||||
let confMode: Lovelace["mode"] = this.panel!.config.mode;
|
||||
@ -301,6 +305,7 @@ export class LovelacePanel extends LitElement {
|
||||
rawConf = DEFAULT_CONFIG;
|
||||
confMode = "generated";
|
||||
} finally {
|
||||
this._loading = false;
|
||||
// Ignore updates for another 2 seconds.
|
||||
if (this.lovelace && this.lovelace.mode === "yaml") {
|
||||
setTimeout(() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user