mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Fix ha-menu-button not hidden (#17102)
This commit is contained in:
parent
b5eb18e163
commit
a227d7a2cf
@ -1,6 +1,6 @@
|
||||
import { mdiMenu } from "@mdi/js";
|
||||
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { subscribeNotifications } from "../data/persistent_notification";
|
||||
@ -17,6 +17,8 @@ class HaMenuButton extends LitElement {
|
||||
|
||||
@state() private _hasNotifications = false;
|
||||
|
||||
@state() private _show = false;
|
||||
|
||||
private _alwaysVisible = false;
|
||||
|
||||
private _attachNotifOnConnect = false;
|
||||
@ -40,7 +42,10 @@ class HaMenuButton extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
protected render() {
|
||||
if (!this._show) {
|
||||
return nothing;
|
||||
}
|
||||
const hasNotifications =
|
||||
this._hasNotifications &&
|
||||
(this.narrow || this.hass.dockedSidebar === "always_hidden");
|
||||
@ -66,8 +71,8 @@ class HaMenuButton extends LitElement {
|
||||
(Number((window.parent as any).frontendVersion) || 0) < 20190710;
|
||||
}
|
||||
|
||||
protected updated(changedProps) {
|
||||
super.updated(changedProps);
|
||||
protected willUpdate(changedProps) {
|
||||
super.willUpdate(changedProps);
|
||||
|
||||
if (!changedProps.has("narrow") && !changedProps.has("hass")) {
|
||||
return;
|
||||
@ -85,11 +90,11 @@ class HaMenuButton extends LitElement {
|
||||
const showButton =
|
||||
this.narrow || this.hass.dockedSidebar === "always_hidden";
|
||||
|
||||
if (oldShowButton === showButton) {
|
||||
if (this.hasUpdated && oldShowButton === showButton) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.style.display = showButton || this._alwaysVisible ? "initial" : "none";
|
||||
this._show = showButton || this._alwaysVisible;
|
||||
|
||||
if (!showButton) {
|
||||
if (this._unsubNotifications) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user