fix(pwa): refresh catalogue manifests in the background (#101) - #102
Merged
Merged
Conversation
…rving them cache-first forever (#101) Every /data/** request was cache-first, and DATA_CACHE has not been bumped since v5, so an installed app kept the manifest it cached on install: after #98 shipped 154 more picture books, existing installs still listed 40. The catalogue files in PRECACHE_DATA (manifests, proverbs, game data) are now stale-while-revalidate in the same cache: instant from cache, refreshed in the background, new books on the next open. Shards, book text, images and audio stay cache-first. Existing DATA_CACHE entries survive; the changed sw.js also re-runs install, which overwrites the precached catalogues right away. Signed-off-by: Devu Dilip <devu.dilip@gmail.com>
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.
Linked issue
Closes #101 (
accepted).What changed and why
public/sw.jsserved every/data/**request cache-first, andDATA_CACHEhas not been bumped since v5, so an installed app kept the manifest it cached on install. After #98 shipped 154 more picture books, existing installs still list 40, and #100's slimmer manifest would never reach them either.The catalogue files already listed in
PRECACHE_DATA(books, picture-book and stories manifests, proverbs, dictionary manifest and game data) are now stale-while-revalidate in the same cache: instant from cache, refreshed in the background, new books visible on the next open. Dictionary shards, book text, images and audio stay cache-first because they never change once built. Nothing saved for offline is dropped. Becausesw.jsitself changed, the new worker's install step re-runsaddAll(PRECACHE_DATA), which overwrites the stale catalogues immediately.A test pins the routing so it cannot silently regress. The sw.js header documents the split and why bumping
DATA_CACHEis reserved for format changes.Verification
npm run typecheckclean,npm testgreen.