Keep service worker shell revalidation alive - #88
Merged
Conversation
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 beforecache.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 failednpx --yes pnpm@11.18.0 typecheckgit diff --checkPrepared with AI assistance for the public $0.25 bug-fix task advertised for AgenticJobs PRs. No payout is represented as approved or paid.