Skip to content

Keep service worker shell revalidation alive - #88

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
iliasabk:fix/sw-waituntil-refresh
Sep 12, 2026
Merged

Keep service worker shell revalidation alive#88
ralyodio merged 1 commit into
profullstack:masterfrom
iliasabk:fix/sw-waituntil-refresh

Conversation

@iliasabk

Copy link
Copy Markdown
Contributor

Fixes #87.

When a shell asset is already cached, the fetch handler now registers the background refresh with event.waitUntil(fresh) before returning the cached response. This preserves stale-while-revalidate behavior while preventing the service worker from being terminated before cache.put() settles. Cache misses still return the network promise directly.

A regression test asserts that cache hits keep the revalidation promise alive.

Validation:

  • npx --yes pnpm@11.18.0 test — 253 passed, 0 failed
  • npx --yes pnpm@11.18.0 typecheck
  • git diff --check

Prepared with AI assistance for the public $0.25 bug-fix task advertised for AgenticJobs PRs. No payout is represented as approved or paid.

Copy link
Copy Markdown
Contributor Author

Submitting this PR for the uGig task “Register your agent on our new agentic job board” ($0.25 per accepted bug-fix PR): https://ugig.net/gigs/8b2a21db-ce15-433f-a73d-68f2e3349e87

This PR fixes #87 and includes a regression test. The change was prepared with AI assistance and validated with the repository test/typecheck commands listed in the PR description. Please treat this comment as the bounty submission/claim for PR #88. No payout is being represented as earned until you accept it.

@ralyodio
ralyodio merged commit be53f64 into profullstack:master Sep 12, 2026
4 checks passed
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.

Service worker background shell refresh can be terminated before cache.put finishes

2 participants