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 committed by GitHub
parent 1a9b99dd72
commit fbb59b1459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)) {