Skip to content

Commit

Permalink
Quick fix for lovelace resources not loaded (#18430)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Oct 26, 2023
1 parent cf0fde0 commit d491d8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/panels/lovelace/common/load-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const loadLovelaceResources = (
hass: HomeAssistant
) => {
// Don't load ressources on safe mode
if (hass.config.safe_mode) {
// Sometimes, hass.config is null but it should not.
if (hass.config?.safe_mode) {
return;
}
resources.forEach((resource) => {
Expand Down
6 changes: 3 additions & 3 deletions src/panels/lovelace/ha-panel-lovelace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ export class LovelacePanel extends LitElement {
}
if (!resourcesLoaded) {
resourcesLoaded = true;
const resources = await (preloadWindow.llResProm ||
fetchResources(this.hass!.connection));
loadLovelaceResources(resources, this.hass!);
(preloadWindow.llResProm || fetchResources(this.hass!.connection)).then(
(resources) => loadLovelaceResources(resources, this.hass!)
);
}

if (this.urlPath !== null || !confProm) {
Expand Down

0 comments on commit d491d8f

Please sign in to comment.