From 53da4a14a0dc182fe9454b3cbd35eb7a790336a8 Mon Sep 17 00:00:00 2001 From: elpatron Date: Tue, 2 Jun 2026 19:39:48 +0200 Subject: [PATCH] fix: delay PWA update checks on visibilitychange/online events to allow network stack stabilization --- client/src/hooks/usePwaUpdate.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/hooks/usePwaUpdate.ts b/client/src/hooks/usePwaUpdate.ts index 2f4eab7..ed4182a 100644 --- a/client/src/hooks/usePwaUpdate.ts +++ b/client/src/hooks/usePwaUpdate.ts @@ -42,12 +42,14 @@ function scheduleUpdateChecks( const onVisibilityChange = () => { if (document.visibilityState === 'visible') { - checkForUpdate() + // Delay check on wake-up to allow the mobile network stack to stabilize + setTimeout(checkForUpdate, 2000) } } const onOnline = () => { - checkForUpdate() + // Small delay to ensure connection is fully established + setTimeout(checkForUpdate, 500) } document.addEventListener('visibilitychange', onVisibilityChange)