mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Unmount on pagehide instead of beforeunload
It seems cluster onbeforeunload is not triggered when iframe is removed from dom by the parent (when disconnecting a cluster). While on root/main frame the beforeunload event does work, it seems to be adviced to use pagehide instead. Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
This commit is contained in:
parent
e1da883c9a
commit
528e18e99e
@ -73,7 +73,7 @@ export const initClusterFrame = ({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
window.onbeforeunload = () => {
|
window.onpagehide = () => {
|
||||||
logger.info(
|
logger.info(
|
||||||
`${logPrefix} Unload dashboard, clusterId=${(hostedCluster.id)}, frameId=${frameRoutingId}`,
|
`${logPrefix} Unload dashboard, clusterId=${(hostedCluster.id)}, frameId=${frameRoutingId}`,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -57,7 +57,7 @@ const initRootFrameInjectable = getInjectable({
|
|||||||
|
|
||||||
registerIpcListeners();
|
registerIpcListeners();
|
||||||
|
|
||||||
window.addEventListener("beforeunload", () => {
|
window.addEventListener("pagehide", () => {
|
||||||
logger.info("[ROOT-FRAME]: Unload app");
|
logger.info("[ROOT-FRAME]: Unload app");
|
||||||
|
|
||||||
unmountRoot();
|
unmountRoot();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user