mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Always define localize func (#1830)
This commit is contained in:
parent
3b1b2b95e7
commit
0fdd1c74f2
@ -11,6 +11,8 @@ import {
|
|||||||
LocalizeMixin,
|
LocalizeMixin,
|
||||||
} from "./localize-base-mixin";
|
} from "./localize-base-mixin";
|
||||||
|
|
||||||
|
const empty = () => "";
|
||||||
|
|
||||||
export const HassLocalizeLitMixin = <T extends LitElement>(
|
export const HassLocalizeLitMixin = <T extends LitElement>(
|
||||||
superClass: Constructor<T>
|
superClass: Constructor<T>
|
||||||
): Constructor<T & LocalizeMixin> =>
|
): Constructor<T & LocalizeMixin> =>
|
||||||
@ -26,6 +28,12 @@ export const HassLocalizeLitMixin = <T extends LitElement>(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
// This will prevent undefined errors if called before connected to DOM.
|
||||||
|
this.localize = empty;
|
||||||
|
}
|
||||||
|
|
||||||
public connectedCallback(): void {
|
public connectedCallback(): void {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user