feat(frontend): finish PWA reset reload and pre-cache the HTML shell

The service worker and web manifest were already in place; close the remaining
gaps against the PWA spec:

- pwa.ts: resetPwa() cleared caches and unregistered the service worker but
  never reloaded, despite its docstring. Add the hard reload so the page
  re-fetches everything from the network after a clear.
- service-worker.ts: pre-cache the SPA entry HTML ('/') alongside build/files
  so the shell — and the offline navigation fallback — works from the very
  first visit, not just after a navigation has been seen by the runtime cache.
- settings: resetPwa now reloads, so the post-clear success toast (which told
  the user to reload manually) is unreachable and misleading. Drop the dead
  pwaSuccess state and toast; keep the disabled "Clearing…" button state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 10:36:20 +03:00
parent e8479ee4fb
commit 7a0c57a79c
3 changed files with 12 additions and 10 deletions
+3
View File
@@ -11,4 +11,7 @@ export async function resetPwa(): Promise<void> {
const keys = await caches.keys();
await Promise.all(keys.map((k) => caches.delete(k)));
}
// Hard reload so the page (and a fresh service worker, if still installed)
// re-fetches everything from the network instead of the now-cleared cache.
location.reload();
}