1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Remove iframe completely on disconnect (#4116)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-10-22 13:19:26 +03:00 committed by Jim Ehrismann
parent 6ee234619d
commit 2b3b40192a
2 changed files with 1 additions and 14 deletions

View File

@ -111,13 +111,6 @@ export class App extends React.Component {
window.location.reload();
});
window.addEventListener("message", (ev: MessageEvent) => {
if (ev.data === "teardown") {
unmountComponentAtNode(rootElem);
window.location.href = "about:blank";
}
});
window.onbeforeunload = () => {
logger.info(`[APP]: Unload dashboard, clusterId=${App.clusterId}, frameId=${frameId}`);

View File

@ -79,13 +79,7 @@ export async function autoCleanOnRemove(clusterId: ClusterId, iframe: HTMLIFrame
logger.info(`[LENS-VIEW]: remove dashboard, clusterId=${clusterId}`);
lensViews.delete(clusterId);
// Keep frame in DOM to avoid possible bugs when same cluster re-created after being removed.
// In that case for some reasons `webFrame.routingId` returns some previous frameId (usage in app.tsx)
// Issue: https://github.com/lensapp/lens/issues/811
iframe.style.display = "none";
iframe.dataset.meta = `${iframe.name} was removed at ${new Date().toLocaleString()}`;
iframe.removeAttribute("name");
iframe.contentWindow.postMessage("teardown", "*");
iframe.parentNode.removeChild(iframe);
}
export function refreshViews(visibleClusterId?: string) {