diff --git a/src/panels/lovelace/cards/hui-discovered-devices-card.ts b/src/panels/lovelace/cards/hui-discovered-devices-card.ts index 4236958124..0579eecaad 100644 --- a/src/panels/lovelace/cards/hui-discovered-devices-card.ts +++ b/src/panels/lovelace/cards/hui-discovered-devices-card.ts @@ -131,9 +131,10 @@ export class HuiDiscoveredDevicesCard } // Update visibility based on admin status and discovered devices count - const shouldBeHidden = + const shouldBeHidden = Boolean( !this.hass.user?.is_admin || - (this._config.hide_empty && this._discoveredFlows.length === 0); + (this._config.hide_empty && this._discoveredFlows.length === 0) + ); if (shouldBeHidden !== this.hidden) { this.style.display = shouldBeHidden ? "none" : ""; diff --git a/src/panels/lovelace/cards/hui-repairs-card.ts b/src/panels/lovelace/cards/hui-repairs-card.ts index 3c9607540e..a5ee3ab9df 100644 --- a/src/panels/lovelace/cards/hui-repairs-card.ts +++ b/src/panels/lovelace/cards/hui-repairs-card.ts @@ -97,9 +97,10 @@ export class HuiRepairsCard } // Update visibility based on admin status and repairs count - const shouldBeHidden = + const shouldBeHidden = Boolean( !this.hass.user?.is_admin || - (this._config.hide_empty && this._repairsIssues.length === 0); + (this._config.hide_empty && this._repairsIssues.length === 0) + ); if (shouldBeHidden !== this.hidden) { this.style.display = shouldBeHidden ? "none" : ""; diff --git a/src/panels/lovelace/cards/hui-updates-card.ts b/src/panels/lovelace/cards/hui-updates-card.ts index 6231dc5dae..a9aad310b2 100644 --- a/src/panels/lovelace/cards/hui-updates-card.ts +++ b/src/panels/lovelace/cards/hui-updates-card.ts @@ -91,9 +91,10 @@ export class HuiUpdatesCard extends LitElement implements LovelaceCard { const updateEntities = this._getUpdateEntities(); // Update visibility based on admin status and updates count - const shouldBeHidden = + const shouldBeHidden = Boolean( !this.hass.user?.is_admin || - (this._config.hide_empty && updateEntities.length === 0); + (this._config.hide_empty && updateEntities.length === 0) + ); if (shouldBeHidden !== this.hidden) { this.style.display = shouldBeHidden ? "none" : ""; @@ -103,7 +104,7 @@ export class HuiUpdatesCard extends LitElement implements LovelaceCard { } protected render(): TemplateResult | typeof nothing { - if (!this._config || !this.hass || this.hidden) { + if (!this._config || !this.hass) { return nothing; }