Prefer nothing over empty templates (#15633)

This commit is contained in:
Steve Repsher
2023-02-28 05:02:47 -05:00
committed by GitHub
parent 4031d9cc78
commit 9ce4563dd4
362 changed files with 1533 additions and 1435 deletions

View File

@@ -4,7 +4,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { property } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
@@ -40,9 +40,9 @@ class HuiGenericEntityRow extends LitElement {
// Default behavior is controlled by DOMAINS_INPUT_ROW.
@property({ type: Boolean }) public catchInteraction?;
protected render(): TemplateResult {
protected render() {
if (!this.hass || !this.config) {
return html``;
return nothing;
}
const stateObj = this.config.entity
? this.hass.states[this.config.entity]
@@ -153,7 +153,7 @@ class HuiGenericEntityRow extends LitElement {
`
: ""}
</div>`
: html``}
: nothing}
${this.catchInteraction ?? !DOMAINS_INPUT_ROW.includes(domain)
? html`<div
class="text-content value ${classMap({