mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Fix invalid state error in PWAUpdatePrompt
This commit is contained in:
1 file changed
+8
-2
@@ -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);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user