Skip to content

fix(pwa): promote waiting SW + periodic update checks so releases land#112

Merged
bmarshall511 merged 1 commit into
mainfrom
fix/pwa-aggressive-update
Jun 28, 2026
Merged

fix(pwa): promote waiting SW + periodic update checks so releases land#112
bmarshall511 merged 1 commit into
mainfrom
fix/pwa-aggressive-update

Conversation

@bmarshall511

Copy link
Copy Markdown
Contributor

A user's installed PWA kept showing an old build (the pre-fix PIN screen) even after close/reopen — the deployed code was correct (works in-browser), but the home-screen app's service worker wasn't taking over.

The existing updater only reacted to controllerchange and checked on load/focus. A worker stuck in "waiting" never activated, so the old bundle kept being served.

Now the updater:

  • actively promotes any waiting/installed worker (postMessage({type:"SKIP_WAITING"}), handled by a new message listener in app/sw.ts),
  • watches updatefoundinstalled and promotes,
  • re-checks for updates on load, on focus, and every 60s,
  • reloads once the new worker controls the page.

Verified the SKIP_WAITING handler ships in the built sw.js and the prod build (incl. SW bundling) succeeds.

Caveat (not code-fixable): iOS only refreshes a home-screen PWA's icon on reinstall, and an install whose SW predates the auto-updater (shipped #50, Jun 23) may need a one-time remove-and-re-add to recover.

🤖 Generated with Claude Code

The installed PWA could keep serving an old build: the updater only checked for a
new SW on load/focus and only reacted to controllerchange, so a worker stuck in
"waiting" never took over. Now the page actively messages waiting/installed
workers to skip waiting (handled by a new SW message listener), watches
updatefound, and re-checks on an interval — then reloads when the new worker
controls the page. Verified the SKIP_WAITING handler ships in the built sw.js.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
pointsy Ready Ready Preview, Comment Jun 28, 2026 11:54pm

Request Review

@bmarshall511 bmarshall511 merged commit d539a58 into main Jun 28, 2026
7 checks passed
@bmarshall511 bmarshall511 deleted the fix/pwa-aggressive-update branch June 28, 2026 23:57
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