We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4cfd57 commit 6c2fecbCopy full SHA for 6c2fecb
‎vanilla/sw.js‎
@@ -83,15 +83,8 @@ function cacheAndUpdate(event, cacheName) {
83
*/
84
async function networkFallbackOnCache(request, cacheName) {
85
console.log('networkFallbackOnCache: ', request.url);
86
- const cache = await caches.open(cacheName);
87
- const cacheResponse = await cache.match(request.clone());
88
-
89
- return fetch(request.clone())
90
- .then(networkResponse => {
91
- cache.put(request, networkResponse.clone());
92
- return networkResponse;
93
- })
94
- .catch(() => cacheResponse);
+ return updateCache(request, cacheName)
+ .catch(() => fromCache(request, cacheName));
95
}
96
97
/**
0 commit comments