Fix non-hass shouldUpdate regressions (#18810)

This commit is contained in:
karwosts 2023-11-29 06:28:38 -08:00 committed by GitHub
parent 4ec11c7cf6
commit bf24740c7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 12 deletions

View File

@ -151,10 +151,11 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
} }
protected shouldUpdate(changedProps: PropertyValues): boolean { protected shouldUpdate(changedProps: PropertyValues): boolean {
if (changedProps.has("_stateHistory")) { return (
return true; hasConfigOrEntitiesChanged(this, changedProps) ||
} changedProps.size > 1 ||
return hasConfigOrEntitiesChanged(this, changedProps); !changedProps.has("hass")
);
} }
protected updated(changedProps: PropertyValues) { protected updated(changedProps: PropertyValues) {

View File

@ -330,7 +330,11 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
} }
protected shouldUpdate(changedProps: PropertyValues): boolean { protected shouldUpdate(changedProps: PropertyValues): boolean {
return hasConfigOrEntityChanged(this, changedProps); return (
hasConfigOrEntityChanged(this, changedProps) ||
changedProps.size > 1 ||
!changedProps.has("hass")
);
} }
protected firstUpdated(): void { protected firstUpdated(): void {

View File

@ -129,10 +129,11 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard {
} }
protected shouldUpdate(changedProps: PropertyValues): boolean { protected shouldUpdate(changedProps: PropertyValues): boolean {
if (changedProps.has("_statistics")) { return (
return true; hasConfigOrEntitiesChanged(this, changedProps) ||
} changedProps.size > 1 ||
return hasConfigOrEntitiesChanged(this, changedProps); !changedProps.has("hass")
);
} }
public willUpdate(changedProps: PropertyValues) { public willUpdate(changedProps: PropertyValues) {

View File

@ -155,7 +155,8 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard {
protected shouldUpdate(changedProps: PropertyValues): boolean { protected shouldUpdate(changedProps: PropertyValues): boolean {
return ( return (
hasConfigOrEntityChanged(this, changedProps) || hasConfigOrEntityChanged(this, changedProps) ||
changedProps.has("forecastEvent") changedProps.size > 1 ||
!changedProps.has("hass")
); );
} }

View File

@ -82,7 +82,11 @@ class HuiMediaPlayerEntityRow extends LitElement implements LovelaceRow {
} }
protected shouldUpdate(changedProps: PropertyValues): boolean { protected shouldUpdate(changedProps: PropertyValues): boolean {
return hasConfigOrEntityChanged(this, changedProps); return (
hasConfigOrEntityChanged(this, changedProps) ||
changedProps.size > 1 ||
!changedProps.has("hass")
);
} }
protected render() { protected render() {

View File

@ -90,7 +90,11 @@ class HuiWeatherEntityRow extends LitElement implements LovelaceRow {
} }
protected shouldUpdate(changedProps: PropertyValues): boolean { protected shouldUpdate(changedProps: PropertyValues): boolean {
return hasConfigOrEntityChanged(this, changedProps); return (
hasConfigOrEntityChanged(this, changedProps) ||
changedProps.size > 1 ||
!changedProps.has("hass")
);
} }
protected updated(changedProps: PropertyValues): void { protected updated(changedProps: PropertyValues): void {