Since your app is a PWA, you can declare a js file for registration in the navigator.serviceWorker object. This my.js file can contain a const CACHE_VERSION = 1.0. Updating this value should force the client to download the latest files. See Jeremy Likness’ blog post for more info.

Example:

service-worker.published.js

const CACHE_VERSION = '2021.05.22.001'  // Increment each time before deployment.
const cacheNamePrefix = 'offline-cache-';
const cacheName = `${cacheNamePrefix}${CACHE_VERSION}`;

Note: The original one does not work. Replace self.assetsManifest.version withCACHE_VERSION

const cacheName = ${cacheNamePrefix}${self.assetsManifest.version};

Sources:

https://stackoverflow.com/questions/61169801/forcing-reload-of-blazor-client-after-publishing-changes

Last modified: May 22, 2021

Author

Comments

Write a Reply or Comment