Fix panels race

This commit is contained in:
Paulus Schoutsen 2019-03-18 10:50:45 -07:00
parent 7caf37275d
commit 6e504020bf
2 changed files with 8 additions and 2 deletions

View File

@ -22,8 +22,11 @@ import { DEFAULT_PANEL } from "../common/const";
const computeUrl = (urlPath) => `/${urlPath}`;
const computePanels = (hass: HomeAssistant) => {
const isAdmin = hass.user.is_admin;
const panels = hass.panels;
if (!panels) {
return [];
}
const isAdmin = hass.user.is_admin;
const sortValue = {
map: 1,
logbook: 2,

View File

@ -80,7 +80,10 @@ class PartialPanelResolver extends HassRouterPage {
const oldHass = changedProps.get("hass") as this["hass"];
if (!oldHass || oldHass.panels !== this.hass!.panels) {
if (
this.hass!.panels &&
(!oldHass || oldHass.panels !== this.hass!.panels)
) {
this._updateRoutes();
}
}