1
0
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:
Sami Tiilikainen 2022-12-21 14:07:18 +02:00
parent e1da883c9a
commit 528e18e99e
2 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ export const initClusterFrame = ({
});
});
window.onbeforeunload = () => {
window.onpagehide = () => {
logger.info(
`${logPrefix} Unload dashboard, clusterId=${(hostedCluster.id)}, frameId=${frameRoutingId}`,
);

View File

@ -57,7 +57,7 @@ const initRootFrameInjectable = getInjectable({
registerIpcListeners();
window.addEventListener("beforeunload", () => {
window.addEventListener("pagehide", () => {
logger.info("[ROOT-FRAME]: Unload app");
unmountRoot();