mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 04:46:34 +00:00
Revert changes to persistent notification in sidebar (#25984)
This commit is contained in:
parent
3bfbe4bde6
commit
7fdf824e97
@ -14,6 +14,7 @@ import {
|
|||||||
mdiTooltipAccount,
|
mdiTooltipAccount,
|
||||||
mdiViewDashboard,
|
mdiViewDashboard,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
|
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||||
import type { CSSResultGroup, PropertyValues } from "lit";
|
import type { CSSResultGroup, PropertyValues } from "lit";
|
||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import {
|
import {
|
||||||
@ -205,6 +206,8 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
private _recentKeydownActiveUntil = 0;
|
private _recentKeydownActiveUntil = 0;
|
||||||
|
|
||||||
|
private _unsubPersistentNotifications: UnsubscribeFunc | undefined;
|
||||||
|
|
||||||
@query(".tooltip") private _tooltip!: HTMLDivElement;
|
@query(".tooltip") private _tooltip!: HTMLDivElement;
|
||||||
|
|
||||||
public hassSubscribe() {
|
public hassSubscribe() {
|
||||||
@ -227,9 +230,6 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
subscribeNotifications(this.hass.connection, (notifications) => {
|
|
||||||
this._notifications = notifications;
|
|
||||||
}),
|
|
||||||
...(this.hass.user?.is_admin
|
...(this.hass.user?.is_admin
|
||||||
? [
|
? [
|
||||||
subscribeRepairsIssueRegistry(this.hass.connection!, (repairs) => {
|
subscribeRepairsIssueRegistry(this.hass.connection!, (repairs) => {
|
||||||
@ -300,6 +300,23 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected firstUpdated(changedProps: PropertyValues) {
|
||||||
|
super.firstUpdated(changedProps);
|
||||||
|
this._subscribePersistentNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
|
private _subscribePersistentNotifications(): void {
|
||||||
|
if (this._unsubPersistentNotifications) {
|
||||||
|
this._unsubPersistentNotifications();
|
||||||
|
}
|
||||||
|
this._unsubPersistentNotifications = subscribeNotifications(
|
||||||
|
this.hass.connection,
|
||||||
|
(notifications) => {
|
||||||
|
this._notifications = notifications;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected updated(changedProps) {
|
protected updated(changedProps) {
|
||||||
super.updated(changedProps);
|
super.updated(changedProps);
|
||||||
if (changedProps.has("alwaysExpand")) {
|
if (changedProps.has("alwaysExpand")) {
|
||||||
@ -311,6 +328,14 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
||||||
|
|
||||||
|
if (
|
||||||
|
this.hass &&
|
||||||
|
oldHass?.connected === false &&
|
||||||
|
this.hass.connected === true
|
||||||
|
) {
|
||||||
|
this._subscribePersistentNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
this._calculateCounts();
|
this._calculateCounts();
|
||||||
|
|
||||||
if (!SUPPORT_SCROLL_IF_NEEDED) {
|
if (!SUPPORT_SCROLL_IF_NEEDED) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user