From d789e872b1f5f184a792aacc80b00edda178c5a0 Mon Sep 17 00:00:00 2001 From: Jason Tudisco Date: Tue, 26 May 2026 23:58:26 -0600 Subject: [PATCH] feat(kez-chat/web): SW auto-reload on deploy + visible build sha in footer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two related changes — both aimed at "can you tell what's deployed?" 1. SW auto-update (no more "refresh twice") The default vite-plugin-pwa autoUpdate behavior was: new SW downloads on first reload, activates on second reload. Users refresh after a deploy, still see old bundle, get confused. Now: • workbox: skipWaiting + clientsClaim → new SW activates and takes control of existing pages immediately on install. • main.ts listens for `controllerchange` and calls reload() once. New SW takes over → page reloads → new bundle loads. Net: deploys land on the FIRST refresh after the new bundle is reachable. (Caveat: the SW that's currently running has to download the new SW first, so the very first refresh after a deploy may serve stale + then auto-reload a beat later.) 2. Visible build sha in the footer vite.config.ts now runs `git rev-parse --short HEAD` at build time and injects __BUILD_SHA__ + __BUILD_TIME__ via Vite's `define`. App.svelte's footer renders the sha as a small monospace chip linking to the commit on gitea, with the build time on hover. "kez-chat web v0.1" → "kez-chat [abc1234] · source" So when you refresh and the chip changes value, you know the new build landed. When it doesn't, you know the SW is still serving the old bundle. 3. Killed the `apple-mobile-web-app-capable` deprecation warning by adding the standard `mobile-web-app-capable` next to it. Co-Authored-By: Claude Opus 4.7 --- kez-chat/web/index.html | 3 +++ kez-chat/web/src/App.svelte | 14 ++++++++++++-- kez-chat/web/src/app.d.ts | 4 ++++ kez-chat/web/src/main.ts | 18 ++++++++++++++++++ kez-chat/web/vite.config.ts | 23 +++++++++++++++++++++++ 5 files changed, 60 insertions(+), 2 deletions(-) diff --git a/kez-chat/web/index.html b/kez-chat/web/index.html index 5dc59d2..e6be98d 100644 --- a/kez-chat/web/index.html +++ b/kez-chat/web/index.html @@ -13,6 +13,9 @@ + + diff --git a/kez-chat/web/src/App.svelte b/kez-chat/web/src/App.svelte index f5358b0..10f35ba 100644 --- a/kez-chat/web/src/App.svelte +++ b/kez-chat/web/src/App.svelte @@ -66,8 +66,18 @@