From 772e23ded88813d01c6833c5a5e3a18c1d93f0e5 Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 6 Jul 2026 10:39:52 -0600 Subject: [PATCH] =?UTF-8?q?fix(pwa):=20bump=20field-shell=20cache=20to=20v?= =?UTF-8?q?2=20=E2=80=94=20evicts=20stale=20UI=20for=20installed=20PWAs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Apple HIG polish pass (liquid-glass chrome, iOS SegmentedControl, ThresholdMeter) was already on origin/main and live, but anyone with the /water PWA installed on their home screen kept seeing the OLD UI because the SW cache name never bumped. Old SW had field-shell-v1 baked into its bytes for every prior deploy. The activate handler only deletes caches that aren't SHELL_CACHE or DATA_CACHE and start with 'field-'. Same name = no eviction = stale HTML + chunks forever. Bumping SHELL_CACHE to 'field-shell-v2' makes the SW bytes change, which triggers the normal SW upgrade flow: install → skipWaiting → activate → claim clients The activate handler then evicts field-shell-v1 (it's now a foreign field-* cache). On next navigation the new SHELL_CACHE is repopulated with the fresh /water HTML + static assets, and the user gets the new UI. --- public/sw-field.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/sw-field.js b/public/sw-field.js index 7e99640..aa13c50 100644 --- a/public/sw-field.js +++ b/public/sw-field.js @@ -12,7 +12,12 @@ // Cache names are deliberately prefixed with `field-` so they never // collide with the main `rc-shell-v*` / `rc-data-v*` caches. -const SHELL_CACHE = "field-shell-v1"; +// Bumped to v2 after the Apple HIG polish pass (liquid-glass chrome, +// iOS SegmentedControl, ThresholdMeter). The activate handler keeps +// only this name + DATA_CACHE — anything else starting with `field-` +// (including the old v1) is evicted on the next SW activation, which +// happens automatically because the bytes of this file changed. +const SHELL_CACHE = "field-shell-v2"; const DATA_CACHE = "field-data-v1"; const OFFLINE_URL = "/offline.html";