mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-31 13:07:49 +00:00
Add shouldUpdate
This commit is contained in:
parent
b766f2f337
commit
d3e2cc9128
@ -7,7 +7,7 @@ import {
|
||||
mdiClose,
|
||||
mdiInformationOutline,
|
||||
} from "@mdi/js";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { css, html, LitElement, PropertyValues } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { classMap } from "lit/directives/class-map";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
@ -47,6 +47,18 @@ class HaAlert extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public rtl = false;
|
||||
|
||||
protected shouldUpdate(changedProps: PropertyValues): boolean {
|
||||
if (changedProps.size !== 1 || !changedProps.has("hass")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const oldHass = changedProps.get("hass") as HomeAssistant;
|
||||
if (!oldHass || !this.hass) {
|
||||
return false;
|
||||
}
|
||||
return this.hass.language !== oldHass.language;
|
||||
}
|
||||
|
||||
public render() {
|
||||
return html`
|
||||
<div
|
||||
|
Loading…
x
Reference in New Issue
Block a user