Fix context provider not updated on initializing of hass object (#16159)

This commit is contained in:
Bram Kragten 2023-04-13 10:56:52 +02:00
parent b15b0e25d6
commit e781be885d
No known key found for this signature in database
GPG Key ID: FBE2DFDB363EF55B

View File

@ -82,6 +82,15 @@ export const contextMixin = <T extends Constructor<HassBaseEl>>(
}),
};
protected hassConnected() {
super.hassConnected();
for (const [key, value] of Object.entries(this.hass!)) {
if (key in this.__contextProviders) {
this.__contextProviders[key]!.setValue(value);
}
}
}
protected _updateHass(obj: Partial<HomeAssistant>) {
super._updateHass(obj);
for (const [key, value] of Object.entries(obj)) {