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

Delay removing iframe to fix renderer crash

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-01-16 16:44:29 -05:00
parent ea17df9559
commit d151551898

View File

@ -88,7 +88,15 @@ export class ClusterFrameHandler {
() => { () => {
this.dependencies.logger.info(`[LENS-VIEW]: remove dashboard, clusterId=${clusterId}`); this.dependencies.logger.info(`[LENS-VIEW]: remove dashboard, clusterId=${clusterId}`);
this.views.delete(clusterId); this.views.delete(clusterId);
parentElem.removeChild(iframe);
// Must only remove iframe from DOM after it unloads old code. Else it crashes
iframe.addEventListener("load", () => parentElem.removeChild(iframe), {
once: true,
});
// This causes the old code to be unloaded.
iframe.setAttribute("src", "");
dispose(); dispose();
}, },
); );