mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Fix race in translations loading (#9499)
This commit is contained in:
parent
2a1e31b5e9
commit
18996535b7
@ -126,7 +126,7 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
||||
this._applyTranslations(this.hass!);
|
||||
}
|
||||
|
||||
protected panelUrlChanged(newPanelUrl) {
|
||||
protected panelUrlChanged(newPanelUrl: string) {
|
||||
super.panelUrlChanged(newPanelUrl);
|
||||
// this may be triggered before hassConnected
|
||||
this._loadFragmentTranslations(
|
||||
@ -339,13 +339,16 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
||||
...data,
|
||||
},
|
||||
};
|
||||
const changes: Partial<HomeAssistant> = {
|
||||
resources,
|
||||
localize: await computeLocalize(this, language, resources),
|
||||
};
|
||||
|
||||
// Update resources immediately, so when a new update comes in we don't miss values
|
||||
this._updateHass({ resources });
|
||||
|
||||
const localize = await computeLocalize(this, language, resources);
|
||||
|
||||
if (language === (this.hass ?? this._pendingHass).language) {
|
||||
this._updateHass(changes);
|
||||
this._updateHass({
|
||||
localize,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user