feat(web): auto-update the PWA when a new release is deployed

Register the service worker from the app (virtual:pwa-register) instead of
the injected script, so an installed PWA that stays open also checks for a
new worker every 30 minutes, when it returns to the foreground and when the
connection comes back. The new worker skips waiting, claims every tab and the
page reloads into it, deferring the reload until the app is backgrounded if
the user is typing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-10-19 13:15:10 -03:00
parent 56853bbdeb
commit 686325d8a4
4 changed files with 91 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
"target": "es2023",
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "esnext",
"types": ["vite/client"],
"types": ["vite/client", "vite-plugin-pwa/vanillajs"],
"allowArbitraryExtensions": true,
"skipLibCheck": true,