Skip to content

Fix app updates downloading every file after the browser drops its cache - #459

Merged
panarch merged 1 commit into
mainfrom
reuse-shell-cache-on-update
Oct 18, 2026
Merged

panarch merged 1 commit into
mainfrom
reuse-shell-cache-on-update

Conversation

@panarch

@panarch panarch commented Oct 17, 2026

Copy link
Copy Markdown
Owner

After a day or two without an update, Chrome can drop the copies it kept of Caffold's app files, and the next update then downloaded every one of them again: 26.6 MB, mostly fonts. On a slow phone link that took minutes, and replies queued behind it on the same connection waited long enough for the live connection to stall and show Reconnecting.

  • A new build's service worker asks about each file an earlier build's shell cache holds, sending that copy's tag, and keeps the copy when the server answers 304. Only files that changed are downloaded, along with / and the manifest, which carry no tag.
  • Each answer is stored as it arrives. If any file cannot be fetched, the new build's cache is deleted and the update stays unprepared, as before.
  • The server is unchanged.

A new build's service worker filled its shell cache with cache.addAll, so an
unchanged file was kept only while the browser's HTTP cache still held it; once
Chrome dropped those copies, the next update downloaded all 26 MB again. It now
asks about each file with the tag of the copy in an earlier build's cache and
keeps that copy when the server answers that it is unchanged.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://reuse-shell-cache-on-update-caffold.taehoon-moon.workers.dev (commit 878ef1c)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://9d6e4fbe-caffold.taehoon-moon.workers.dev 878ef1c 2026-10-17T23:20:56.558Z Visit the dashboard ↗

@panarch panarch self-assigned this Oct 18, 2026
@panarch
panarch merged commit 0bf0c2d into main Oct 18, 2026
10 checks passed
@panarch
panarch deleted the reuse-shell-cache-on-update branch October 18, 2026 07:23
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