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:
parent
6ee234619d
commit
2b3b40192a
@ -111,13 +111,6 @@ export class App extends React.Component {
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("message", (ev: MessageEvent) => {
|
|
||||||
if (ev.data === "teardown") {
|
|
||||||
unmountComponentAtNode(rootElem);
|
|
||||||
window.location.href = "about:blank";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.onbeforeunload = () => {
|
window.onbeforeunload = () => {
|
||||||
logger.info(`[APP]: Unload dashboard, clusterId=${App.clusterId}, frameId=${frameId}`);
|
logger.info(`[APP]: Unload dashboard, clusterId=${App.clusterId}, frameId=${frameId}`);
|
||||||
|
|
||||||
|
|||||||
@ -79,13 +79,7 @@ export async function autoCleanOnRemove(clusterId: ClusterId, iframe: HTMLIFrame
|
|||||||
logger.info(`[LENS-VIEW]: remove dashboard, clusterId=${clusterId}`);
|
logger.info(`[LENS-VIEW]: remove dashboard, clusterId=${clusterId}`);
|
||||||
lensViews.delete(clusterId);
|
lensViews.delete(clusterId);
|
||||||
|
|
||||||
// Keep frame in DOM to avoid possible bugs when same cluster re-created after being removed.
|
iframe.parentNode.removeChild(iframe);
|
||||||
// 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", "*");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function refreshViews(visibleClusterId?: string) {
|
export function refreshViews(visibleClusterId?: string) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user