mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 01:06:35 +00:00
Fix blank page in ingress when resizing window (#8439)
This commit is contained in:
parent
b5ec59c396
commit
fd9441dde2
@ -23,7 +23,7 @@ class HassioRouter extends HassRouterPage {
|
|||||||
protected routerOptions: RouterOptions = {
|
protected routerOptions: RouterOptions = {
|
||||||
// Hass.io has a page with tabs, so we route all non-matching routes to it.
|
// Hass.io has a page with tabs, so we route all non-matching routes to it.
|
||||||
defaultPage: "dashboard",
|
defaultPage: "dashboard",
|
||||||
initialLoad: () => this._fetchData(),
|
initialLoad: () => this._redirectIngress(),
|
||||||
showLoading: true,
|
showLoading: true,
|
||||||
routes: {
|
routes: {
|
||||||
dashboard: {
|
dashboard: {
|
||||||
@ -50,7 +50,13 @@ class HassioRouter extends HassRouterPage {
|
|||||||
|
|
||||||
protected updatePageEl(el) {
|
protected updatePageEl(el) {
|
||||||
// the tabs page does its own routing so needs full route.
|
// the tabs page does its own routing so needs full route.
|
||||||
const route = el.nodeName === "HASSIO-PANEL" ? this.route : this.routeTail;
|
const hassioPanel = el.nodeName === "HASSIO-PANEL";
|
||||||
|
const route = hassioPanel ? this.route : this.routeTail;
|
||||||
|
|
||||||
|
if (hassioPanel && this.panel.config?.ingress) {
|
||||||
|
this._redirectIngress();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
el.hass = this.hass;
|
el.hass = this.hass;
|
||||||
el.narrow = this.narrow;
|
el.narrow = this.narrow;
|
||||||
@ -63,15 +69,14 @@ class HassioRouter extends HassRouterPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _fetchData() {
|
private async _redirectIngress() {
|
||||||
if (this.panel.config && this.panel.config.ingress) {
|
if (this.panel.config && this.panel.config.ingress) {
|
||||||
this._redirectIngress(this.panel.config.ingress);
|
this.route = {
|
||||||
|
prefix: "/hassio",
|
||||||
|
path: `/ingress/${this.panel.config.ingress}`,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _redirectIngress(addonSlug: string) {
|
|
||||||
this.route = { prefix: "/hassio", path: `/ingress/${addonSlug}` };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user