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

@@ -7,7 +7,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, state } from "lit/decorators";
import { fireEvent, HASSDomEvent } from "../../common/dom/fire_event";
@@ -202,9 +202,9 @@ class DataEntryFlowDialog extends LitElement {
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._params) {
return html``;
return nothing;
}
return html`

View File

@@ -1,19 +1,13 @@
import "@material/mwc-button";
import {
CSSResultGroup,
html,
LitElement,
TemplateResult,
PropertyValues,
} from "lit";
import { CSSResultGroup, html, LitElement, PropertyValues, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { DataEntryFlowStepAbort } from "../../data/data_entry_flow";
import { HomeAssistant } from "../../types";
import { showAddApplicationCredentialDialog } from "../../panels/config/application_credentials/show-dialog-add-application-credential";
import { configFlowContentStyles } from "./styles";
import { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow";
import { HomeAssistant } from "../../types";
import { showConfigFlowDialog } from "./show-dialog-config-flow";
import { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow";
import { configFlowContentStyles } from "./styles";
@customElement("step-flow-abort")
class StepFlowAbort extends LitElement {
@@ -32,9 +26,9 @@ class StepFlowAbort extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (this.step.reason === "missing_credentials") {
return html``;
return nothing;
}
return html`
<h2>${this.hass.localize(`component.${this.domain}.title`)}</h2>