mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +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>[] {
|
||||
return [
|
||||
this.hass!.connection.subscribeEvents(
|
||||
() => this._fetchData(),
|
||||
"shopping_list_updated"
|
||||
),
|
||||
this.hass!.connection.subscribeEvents(() => {
|
||||
if (
|
||||
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);
|
||||
}
|
||||
|
||||
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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user