Revert "feat: optimize PWA service worker update strategy for better caching"

This reverts commit 5856db6781.
This commit is contained in:
weishu
2025-12-18 23:24:39 +08:00
parent 55b1a753ba
commit 7042596c90
2 changed files with 9 additions and 9 deletions
+8 -6
View File
@@ -11,18 +11,20 @@ async function bootstrap() {
await loadTelegramSdk()
}
registerSW({
immediate: true,
const updateSW = registerSW({
onNeedRefresh() {
if (confirm('New version available! Reload to update?')) {
updateSW(true)
}
},
onOfflineReady() {
console.log('App ready for offline use')
},
onRegistered(registration) {
if (registration) {
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') {
setInterval(() => {
registration.update()
}
})
}, 60 * 60 * 1000)
}
},
onRegisterError(error) {
-2
View File
@@ -44,8 +44,6 @@ export default defineConfig({
]
},
workbox: {
skipWaiting: true,
clientsClaim: true,
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'],
runtimeCaching: [
{