feat: update ready keeps showing even after updating
Task #61 completed by ClaudeQueue ClaudeQueue
This commit is contained in:
@@ -9,21 +9,24 @@
|
||||
* Everything else → network, fallback to cache
|
||||
*
|
||||
* Auto-update flow:
|
||||
* 1. New SW installs alongside the old one.
|
||||
* 2. activate: if an older *versioned shell cache* is found (i.e. this
|
||||
* 1. New SW installs alongside the old one and waits (skipWaiting() is NOT
|
||||
* called automatically — see the install handler below).
|
||||
* 2. Client (app.js registerServiceWorker()) notices the waiting worker
|
||||
* and shows the "Update ready" banner.
|
||||
* 3. User clicks "Reload now" → client (applyUpdate() in sw-update.js)
|
||||
* posts SKIP_WAITING to the waiting worker and waits for it to take
|
||||
* control (controllerchange) before reloading — it does NOT unregister
|
||||
* or wipe caches, so the reload doesn't force a brand-new install.
|
||||
* 4. activate: if an older *versioned shell cache* is found (i.e. this
|
||||
* activation is genuinely replacing a previous deploy, not just the
|
||||
* first-ever install of a freshly (re)registered worker), broadcast
|
||||
* SW_UPDATE_AVAILABLE to all clients.
|
||||
* 3. Client shows "Update ready" banner.
|
||||
* 4. User clicks "Refresh UI" → client (hardReloadUI in app.js) wipes every
|
||||
* cache, unregisters the SW, and hard-navigates to fetch everything
|
||||
* fresh from the network.
|
||||
* SW_UPDATE_AVAILABLE to all clients as a secondary/fallback signal.
|
||||
* ========================================================================== */
|
||||
|
||||
// BUILD_TAG is injected by the server at request time (GET /sw.js).
|
||||
// It changes on every deploy/restart so the cache is busted automatically
|
||||
// without any manual version bump.
|
||||
const VERSION = typeof __BUILD_TAG__ !== 'undefined' ? __BUILD_TAG__ : 'v1.0.3';
|
||||
const VERSION = typeof __BUILD_TAG__ !== 'undefined' ? __BUILD_TAG__ : 'v1.0.4';
|
||||
const CACHE = 'ytplayer-' + VERSION;
|
||||
|
||||
// Prefix shared by every versioned app-shell cache (ytplayer-<VERSION>).
|
||||
@@ -41,6 +44,7 @@ const SHELL = [
|
||||
'/index.html',
|
||||
'/styles.css',
|
||||
'/async-guard.js',
|
||||
'/sw-update.js',
|
||||
'/fingerprint.js',
|
||||
'/opfs.js',
|
||||
'/app.js',
|
||||
|
||||
Reference in New Issue
Block a user