Stale Cache And Update Bugs

SymptomLikely causeFix
Users see old UI after deployWaiting service worker or cached HTMLAdd update prompt and avoid long-lived HTML cache
App crashes after updateOld HTML references removed chunksFingerprint assets and coordinate reload/update
Infinite reload loopWorker activates and reloads repeatedlyGate reload to one user action or version transition
Offline page never updatesOffline fallback cached foreverVersion fallback page and clear old caches
API data is staleRuntime cache lacks expiration/invalidationAdd cache expiration or network-first strategy
Cache grows foreverRuntime caches unboundedAdd max entries, max age, and cleanup

Recovery Procedure

  1. Open DevTools, Application, Service workers.
  2. Check current worker state and waiting worker.
  3. Inspect Cache Storage names and entries.
  4. Clear only caches first, not IndexedDB user data.
  5. Confirm new deployment with a fresh profile.
  6. Add regression test for offline reload after deploy.