Throttle counting updates (#12223)

This commit is contained in:
Paulus Schoutsen
2022-04-05 00:55:01 -07:00
committed by GitHub
parent 65c4d02452
commit 61dc4eaaea
2 changed files with 21 additions and 20 deletions

View File

@@ -3,7 +3,6 @@ import { UnsubscribeFunc } from "home-assistant-js-websocket";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
import { computeDomain } from "../common/entity/compute_domain";
import { subscribeNotifications } from "../data/persistent_notification";
import { HomeAssistant } from "../types";
import "./ha-icon-button";
@@ -43,18 +42,15 @@ class HaMenuButton extends LitElement {
protected render(): TemplateResult {
const hasNotifications =
(this.narrow || this.hass.dockedSidebar === "always_hidden") &&
(this._hasNotifications ||
Object.keys(this.hass.states).some(
(entityId) => computeDomain(entityId) === "configurator"
));
this._hasNotifications &&
(this.narrow || this.hass.dockedSidebar === "always_hidden");
return html`
<ha-icon-button
.label=${this.hass.localize("ui.sidebar.sidebar_toggle")}
.path=${mdiMenu}
@click=${this._toggleMenu}
></ha-icon-button>
${hasNotifications ? html` <div class="dot"></div> ` : ""}
${hasNotifications ? html`<div class="dot"></div>` : ""}
`;
}