mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Fix race condition in translation loading (#7597)
This commit is contained in:
parent
9a3a7c28f4
commit
461b86a04b
@ -221,9 +221,15 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
||||
// loaded resources. This merges the new data on top of the old data for
|
||||
// this language, so that the full translation set can be loaded across
|
||||
// multiple fragments.
|
||||
//
|
||||
// Beware of a subtle race condition: it is possible to get here twice
|
||||
// before this.hass is even created. In this case our base state comes
|
||||
// from this._pendingHass instead. Otherwise the first set of strings is
|
||||
// overwritten when we call _updateHass the second time!
|
||||
const baseHass = this.hass ?? this._pendingHass;
|
||||
const resources = {
|
||||
[language]: {
|
||||
...this.hass?.resources?.[language],
|
||||
...baseHass?.resources?.[language],
|
||||
...data,
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user