⚗️(service-worker) remove index from cache first strategy

Some users reported that the app was giving a
blank page, it seems to happens often after a
release. It could be due to the fact that
the service worker is caching the index.html
file and not updating it properly after a new release.
We remove the index from the cache first strategy
to avoid this kind of issue. We set as well
the default handler with the "StaleWhileRevalidate"
strategy to force the cache to be updated in
the background.
This commit is contained in:
Anthony LC
2025-09-17 10:29:45 +02:00
parent fbdeb90113
commit 2dc1e07b42
2 changed files with 4 additions and 4 deletions

View File

@@ -19,7 +19,9 @@ and this project adheres to
### Fixed
- 🐛(backend) duplicate sub docs as root for reader users
- ⚗️(service-worker) remove index from cache first strategy #1395
- 🐛(frontend) fix 404 page when reload 403 page #1402
- 🐛(frontend) fix legacy role computation #1376
## [3.7.0] - 2025-09-12
@@ -47,7 +49,6 @@ and this project adheres to
### Fixed
- 🐛(frontend) fix callout emoji list #1366
- 🐛(frontend) fix legacy role computation #1376
## [3.6.0] - 2025-09-04

View File

@@ -15,6 +15,7 @@ import {
NetworkFirst,
NetworkFirstOptions,
NetworkOnly,
StaleWhileRevalidate,
StrategyOptions,
} from 'workbox-strategies';
@@ -104,8 +105,6 @@ const FALLBACK = {
images: '/assets/img-not-found.svg',
};
const precacheResources = [
'/',
'/index.html',
'/401/',
'/404/',
FALLBACK.offline,
@@ -255,7 +254,7 @@ registerRoute(
* Cache all other files
*/
setDefaultHandler(
getStrategy({
new StaleWhileRevalidate({
cacheName: getCacheNameVersion('default'),
plugins: [
new CacheableResponsePlugin({ statuses: [0, 200] }),