Skip to content

fix(pwa): stop auto-reload on service worker update#686

Merged
koala73 merged 1 commit intomainfrom
fix/pwa-stop-auto-reload
Mar 1, 2026
Merged

fix(pwa): stop auto-reload on service worker update#686
koala73 merged 1 commit intomainfrom
fix/pwa-stop-auto-reload

Conversation

@koala73
Copy link
Owner

@koala73 koala73 commented Mar 1, 2026

Summary

  • Replace virtual:pwa-register with manual navigator.serviceWorker.register() to eliminate the forced page reload triggered by the PWA auto-update controllerchange listener
  • All PWA functionality preserved: precaching, offline support, hourly update checks
  • chunk-reload.ts guard still handles stale chunk 404s as safety net

Context

With registerType: 'autoUpdate' + skipWaiting + clientsClaim, every deployment caused a visible full-page reload on first visit — the new SW installs, activates, claims the page, and virtual:pwa-register's controllerchange handler calls window.location.reload().

Test plan

  • Deploy and verify page loads without a second reload
  • Verify PWA install still works (precaching, offline)
  • Verify new deployments serve updated assets on next navigation

virtual:pwa-register with registerType 'autoUpdate' installs a
controllerchange listener that calls window.location.reload() whenever
a new SW takes control. Combined with skipWaiting + clientsClaim, every
deployment triggered a visible full-page reload on first visit.

Replace with manual navigator.serviceWorker.register() that preserves
all PWA functionality (precaching, offline, hourly update checks) without
the forced reload. chunk-reload.ts still handles stale chunk 404s.
@vercel
Copy link

vercel bot commented Mar 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldmonitor Building Building Preview, Comment Mar 1, 2026 6:13pm
worldmonitor-finance Building Building Preview, Comment Mar 1, 2026 6:13pm
worldmonitor-happy Building Building Preview, Comment Mar 1, 2026 6:13pm
worldmonitor-startup Building Building Preview, Comment Mar 1, 2026 6:13pm

Request Review

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant