mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 10:16:46 +00:00
Skip disconnect of custom panels and iframe panels (#6248)
This commit is contained in:
parent
d8661cf2db
commit
e4d55e6842
@ -13,6 +13,7 @@ import {
|
|||||||
STATE_NOT_RUNNING,
|
STATE_NOT_RUNNING,
|
||||||
STATE_RUNNING,
|
STATE_RUNNING,
|
||||||
} from "home-assistant-js-websocket";
|
} from "home-assistant-js-websocket";
|
||||||
|
import { CustomPanelInfo } from "../data/panel_custom";
|
||||||
|
|
||||||
const CACHE_URL_PATHS = ["lovelace", "developer-tools"];
|
const CACHE_URL_PATHS = ["lovelace", "developer-tools"];
|
||||||
const COMPONENTS = {
|
const COMPONENTS = {
|
||||||
@ -159,7 +160,17 @@ class PartialPanelResolver extends HassRouterPage {
|
|||||||
if (document.hidden) {
|
if (document.hidden) {
|
||||||
this._hiddenTimeout = window.setTimeout(() => {
|
this._hiddenTimeout = window.setTimeout(() => {
|
||||||
this._hiddenTimeout = undefined;
|
this._hiddenTimeout = undefined;
|
||||||
if (this.lastChild) {
|
const curPanel = this.hass.panels[this._currentPage];
|
||||||
|
if (
|
||||||
|
this.lastChild &&
|
||||||
|
// iFrames will lose their state when disconnected
|
||||||
|
// Do not disconnect any iframe panel
|
||||||
|
curPanel.component_name !== "iframe" &&
|
||||||
|
// Do not disconnect any custom panel that embeds into iframe (ie hassio)
|
||||||
|
(curPanel.component_name !== "custom" ||
|
||||||
|
!(curPanel.config as CustomPanelInfo).config._panel_custom
|
||||||
|
.embed_iframe)
|
||||||
|
) {
|
||||||
this._disconnectedPanel = this.lastChild;
|
this._disconnectedPanel = this.lastChild;
|
||||||
this.removeChild(this.lastChild);
|
this.removeChild(this.lastChild);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user