Skip to content

fix(pwa): refresh catalogue manifests in the background (#101) - #102

Merged
devudilip merged 1 commit into
mainfrom
fix/sw-manifest-freshness
Sep 16, 2026
Merged

devudilip merged 1 commit into
mainfrom
fix/sw-manifest-freshness

Conversation

@devudilip

Copy link
Copy Markdown
Owner

Linked issue

Closes #101 (accepted).

What changed and why

public/sw.js served every /data/** request 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 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. Because sw.js itself changed, the new worker's install step re-runs addAll(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_CACHE is reserved for format changes.

Verification

  • npm run typecheck clean, npm test green.
  • No change to precached routes; bundle check unaffected.

…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>
@devudilip
devudilip merged commit a3b24a6 into main Sep 16, 2026
3 checks passed
@devudilip
devudilip deleted the fix/sw-manifest-freshness branch September 16, 2026 18:01
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.

PWA: installed clients never see new books — manifests are cache-first and DATA_CACHE is never bumped

1 participant