Fix invalid state error in PWAUpdatePrompt

This commit is contained in:
Alex Gleason committed 2025-11-05 00:40:29 -06:00
1 parent 00f843fb4b
commit 481e8d46cf
1 file changed
+8 -2
+8 -2
View File
@@ -19,8 +19,14 @@ export function PWAUpdatePrompt() {
// Check for updates periodically (every hour) // Check for updates periodically (every hour)
if (registration) { if (registration) {
setInterval(() => { const intervalId = setInterval(async () => {
registration.update(); try {
await registration.update();
} catch (error) {
// Registration may no longer be valid, clear the interval
console.warn('[PWA] Failed to check for updates:', error);
clearInterval(intervalId);
}
}, 60 * 60 * 1000); }, 60 * 60 * 1000);
} }
}, },