From 48c408302f561909487db9facef6f29ba6d1c3a9 Mon Sep 17 00:00:00 2001 From: elpatron Date: Sun, 31 May 2026 14:28:01 +0200 Subject: [PATCH] =?UTF-8?q?fix(pwa):=20Hintergrund-SW-Updates=20w=C3=A4hre?= =?UTF-8?q?nd=20Update-Suppression=20unterbinden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Das periodische Intervall nutzt checkForUpdate() und respektiert damit „Später“ wie Fokus- und Online-Checks. Co-authored-by: Cursor --- client/src/hooks/usePwaUpdate.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/client/src/hooks/usePwaUpdate.ts b/client/src/hooks/usePwaUpdate.ts index e4269ad..d429450 100644 --- a/client/src/hooks/usePwaUpdate.ts +++ b/client/src/hooks/usePwaUpdate.ts @@ -9,7 +9,6 @@ import { import { isDeployedVersionNewer } from '../services/pwaVersion.js' const UPDATE_CHECK_INTERVAL_MS = 15 * 60 * 1000 -const VERSION_CHECK_INTERVAL_MS = 10 * 60 * 1000 const UPDATE_SUPPRESS_KEY = 'pwa_update_suppress_until' const UPDATE_SUPPRESS_MS = 30_000 const UPDATE_DISMISS_SUPPRESS_MS = 15 * 60 * 1000 @@ -53,23 +52,14 @@ function scheduleUpdateChecks( document.addEventListener('visibilitychange', onVisibilityChange) window.addEventListener('online', onOnline) - const swIntervalId = window.setInterval(() => { - registration.update().catch(() => {}) - }, UPDATE_CHECK_INTERVAL_MS) - const versionIntervalId = window.setInterval(() => { - if (isUpdateSuppressed()) return - void isDeployedVersionNewer().then((outdated) => { - if (outdated && !isUpdateSuppressed()) onOutdated() - }) - }, VERSION_CHECK_INTERVAL_MS) + const updateIntervalId = window.setInterval(checkForUpdate, UPDATE_CHECK_INTERVAL_MS) checkForUpdate() return () => { document.removeEventListener('visibilitychange', onVisibilityChange) window.removeEventListener('online', onOnline) - window.clearInterval(swIntervalId) - window.clearInterval(versionIntervalId) + window.clearInterval(updateIntervalId) } }