From 4757f7394029e737ebdfe198a7b81ade318a0a8e Mon Sep 17 00:00:00 2001 From: Frederic Henrichs Date: Thu, 6 Mar 2025 15:46:55 +0100 Subject: [PATCH] frontend/utils: check time elapsed since lastAlive on app reload. This ensures the app wasnt stopped in the background before appSleeps was set. fix #145 --- frontend/src/utils.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils.tsx b/frontend/src/utils.tsx index f677862..7f9252d 100644 --- a/frontend/src/utils.tsx +++ b/frontend/src/utils.tsx @@ -147,7 +147,9 @@ if (debug) { } window.addEventListener("appReload", () => { - if (appSleeps) { + // Sometime the appSleeps value seems not beeing set. To encounter this check if the lastAlive was + // set during the timout of the wireguard connection + if (appSleeps || Date.now() - lastAlive >= 1000 * 60 * 2) { window.location.reload(); } });