Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip disconnect of custom panels and iframe panels #6248

Merged
merged 1 commit into from Jun 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/layouts/partial-panel-resolver.ts
Expand Up @@ -13,6 +13,7 @@ import {
STATE_NOT_RUNNING,
STATE_RUNNING,
} from "home-assistant-js-websocket";
import { CustomPanelInfo } from "../data/panel_custom";

const CACHE_URL_PATHS = ["lovelace", "developer-tools"];
const COMPONENTS = {
Expand Down Expand Up @@ -159,7 +160,17 @@ class PartialPanelResolver extends HassRouterPage {
if (document.hidden) {
this._hiddenTimeout = window.setTimeout(() => {
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.removeChild(this.lastChild);
}
Expand Down