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

cleanup iframe when cluster is disconnected

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-02-11 09:05:26 +02:00
parent b144eb916b
commit aee03ab132

View File

@ -40,7 +40,15 @@ export async function initView(clusterId: ClusterId) {
} }
export async function autoCleanOnRemove(clusterId: ClusterId, iframe: HTMLIFrameElement) { export async function autoCleanOnRemove(clusterId: ClusterId, iframe: HTMLIFrameElement) {
await when(() => !clusterStore.getById(clusterId)); await when(() => {
const cluster = clusterStore.getById(clusterId);
if (!cluster) return true;
const view = lensViews.get(clusterId);
return cluster.disconnected && view?.isLoaded;
});
logger.info(`[LENS-VIEW]: remove dashboard, clusterId=${clusterId}`); logger.info(`[LENS-VIEW]: remove dashboard, clusterId=${clusterId}`);
lensViews.delete(clusterId); lensViews.delete(clusterId);