Reduce service worker caching to avoid stale bundles
This commit is contained in:
parent
9ae743364a
commit
ae61e19e09
|
|
@ -1,8 +1,6 @@
|
|||
// public/service-worker.js
|
||||
const CACHE_NAME = 'sociowire-v3';
|
||||
const CACHE_NAME = 'sociowire-v4';
|
||||
const PRECACHE = [
|
||||
'/',
|
||||
'/index.html',
|
||||
'/icons/icon-192x192.png',
|
||||
'/icons/icon-512x512.png',
|
||||
'/icons/apple-touch-icon.png',
|
||||
|
|
@ -36,12 +34,7 @@ self.addEventListener('fetch', event => {
|
|||
if (event.request.mode === 'navigate') {
|
||||
event.respondWith(
|
||||
fetch(event.request)
|
||||
.then(response => {
|
||||
const copy = response.clone();
|
||||
caches.open(CACHE_NAME).then(cache => cache.put('/index.html', copy));
|
||||
return response;
|
||||
})
|
||||
.catch(() => caches.match('/index.html'))
|
||||
.catch(() => caches.match('/'))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue