mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix (#3741)
This commit is contained in:
parent
2b1f9460a8
commit
27264b27a9
@ -5,6 +5,7 @@ import {
|
|||||||
PropertyDeclarations,
|
PropertyDeclarations,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||||
|
import { HomeAssistant } from "../types";
|
||||||
|
|
||||||
export interface HassSubscribeElement {
|
export interface HassSubscribeElement {
|
||||||
hassSubscribe(): UnsubscribeFunc[];
|
hassSubscribe(): UnsubscribeFunc[];
|
||||||
@ -16,6 +17,7 @@ export const SubscribeMixin = <T extends LitElement>(
|
|||||||
): Constructor<T & HassSubscribeElement> =>
|
): Constructor<T & HassSubscribeElement> =>
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
class extends superClass {
|
class extends superClass {
|
||||||
|
private hass?: HomeAssistant;
|
||||||
/* tslint:disable-next-line */
|
/* tslint:disable-next-line */
|
||||||
private __unsubs?: UnsubscribeFunc[];
|
private __unsubs?: UnsubscribeFunc[];
|
||||||
|
|
||||||
@ -56,7 +58,7 @@ export const SubscribeMixin = <T extends LitElement>(
|
|||||||
if (
|
if (
|
||||||
this.__unsubs !== undefined ||
|
this.__unsubs !== undefined ||
|
||||||
!((this as unknown) as Element).isConnected ||
|
!((this as unknown) as Element).isConnected ||
|
||||||
super.hass === undefined
|
this.hass === undefined
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user