mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Prevent re-creation of custom panel when content was not changed (#13747)
This commit is contained in:
parent
3083d5b04c
commit
17a11809de
@ -61,7 +61,7 @@ export interface EntityRegistryEntryUpdateParams {
|
||||
hidden_by: string | null;
|
||||
new_entity_id?: string;
|
||||
options_domain?: string;
|
||||
options?: SensorEntityOptions | WeatherEntityOptions;
|
||||
options?: SensorEntityOptions | NumberEntityOptions | WeatherEntityOptions;
|
||||
}
|
||||
|
||||
export const findBatteryEntity = (
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { PropertyValues, ReactiveElement } from "lit";
|
||||
import { property } from "lit/decorators";
|
||||
import { navigate, NavigateOptions } from "../../common/navigate";
|
||||
import { deepEqual } from "../../common/util/deep-equal";
|
||||
import { CustomPanelInfo } from "../../data/panel_custom";
|
||||
import { HomeAssistant, Route } from "../../types";
|
||||
import { createCustomPanelElement } from "../../util/custom-panel/create-custom-panel-element";
|
||||
@ -54,12 +55,15 @@ export class HaPanelCustom extends ReactiveElement {
|
||||
protected update(changedProps: PropertyValues) {
|
||||
super.update(changedProps);
|
||||
if (changedProps.has("panel")) {
|
||||
// Clean up old things if we had a panel
|
||||
if (changedProps.get("panel")) {
|
||||
this._cleanupPanel();
|
||||
// Clean up old things if we had a panel and the new one is different.
|
||||
const oldPanel = changedProps.get("panel") as CustomPanelInfo | undefined;
|
||||
if (!deepEqual(oldPanel, this.panel)) {
|
||||
if (oldPanel) {
|
||||
this._cleanupPanel();
|
||||
}
|
||||
this._createPanel(this.panel);
|
||||
return;
|
||||
}
|
||||
this._createPanel(this.panel);
|
||||
return;
|
||||
}
|
||||
if (!this._setProperties) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user