mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-26 22:37:21 +00:00
Only set tip once (#11853)
This commit is contained in:
parent
91e4557625
commit
4031009c26
@ -17,7 +17,7 @@ import {
|
|||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-icon-next";
|
import "../../../components/ha-icon-next";
|
||||||
@ -118,6 +118,8 @@ class HaConfigDashboard extends LitElement {
|
|||||||
|
|
||||||
@property() public showAdvanced!: boolean;
|
@property() public showAdvanced!: boolean;
|
||||||
|
|
||||||
|
@state() private _tip?: string;
|
||||||
|
|
||||||
private _notifyUpdates = false;
|
private _notifyUpdates = false;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
@ -204,7 +206,7 @@ class HaConfigDashboard extends LitElement {
|
|||||||
<div class="tips">
|
<div class="tips">
|
||||||
<ha-svg-icon .path=${mdiLightbulbOutline}></ha-svg-icon>
|
<ha-svg-icon .path=${mdiLightbulbOutline}></ha-svg-icon>
|
||||||
<span class="tip-word">Tip!</span>
|
<span class="tip-word">Tip!</span>
|
||||||
<span class="text">${randomTip(this.hass)}</span>
|
<span class="text">${this._tip}</span>
|
||||||
</div>
|
</div>
|
||||||
</ha-config-section>
|
</ha-config-section>
|
||||||
</ha-app-layout>
|
</ha-app-layout>
|
||||||
@ -214,6 +216,10 @@ class HaConfigDashboard extends LitElement {
|
|||||||
protected override updated(changedProps: PropertyValues): void {
|
protected override updated(changedProps: PropertyValues): void {
|
||||||
super.updated(changedProps);
|
super.updated(changedProps);
|
||||||
|
|
||||||
|
if (!this._tip && changedProps.has("hass")) {
|
||||||
|
this._tip = randomTip(this.hass);
|
||||||
|
}
|
||||||
|
|
||||||
if (!changedProps.has("supervisorUpdates") || !this._notifyUpdates) {
|
if (!changedProps.has("supervisorUpdates") || !this._notifyUpdates) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user