mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Update todo list items when entity changes, only refresh on shopping … (#18445)
This commit is contained in:
parent
9207f6c407
commit
4f09485b20
@ -135,10 +135,14 @@ export class HuiTodoListCard
|
|||||||
|
|
||||||
public hassSubscribe(): Promise<UnsubscribeFunc>[] {
|
public hassSubscribe(): Promise<UnsubscribeFunc>[] {
|
||||||
return [
|
return [
|
||||||
this.hass!.connection.subscribeEvents(
|
this.hass!.connection.subscribeEvents(() => {
|
||||||
() => this._fetchData(),
|
if (
|
||||||
"shopping_list_updated"
|
this._entityId &&
|
||||||
),
|
this.hass!.entities[this._entityId]?.platform === "shopping_list"
|
||||||
|
) {
|
||||||
|
this._fetchData();
|
||||||
|
}
|
||||||
|
}, "shopping_list_updated"),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +163,15 @@ export class HuiTodoListCard
|
|||||||
) {
|
) {
|
||||||
applyThemesOnElement(this, this.hass.themes, this._config.theme);
|
applyThemesOnElement(this, this.hass.themes, this._config.theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
this._entityId &&
|
||||||
|
oldHass &&
|
||||||
|
oldHass.states[this._entityId] !== this.hass.states[this._entityId] &&
|
||||||
|
this.hass.entities[this._entityId]?.platform !== "shopping_list"
|
||||||
|
) {
|
||||||
|
this._fetchData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user