We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 40f425f commit 0417361Copy full SHA for 0417361
app/public/service-worker.js
@@ -43,7 +43,17 @@ self.addEventListener('install', (event) => {
43
event.waitUntil(
44
caches
45
.open(PRECACHE)
46
- .then((cache) => Promise.allSettled(CORE_ASSETS.map((asset) => cache.add(asset))))
+ .then((cache) => {
47
+ // Map assets to their cache.add promises
48
+ const assetPromises = CORE_ASSETS.map((asset) => cache.add(asset));
49
+ return Promise.allSettled(assetPromises).then((results) => {
50
+ results.forEach((result, i) => {
51
+ if (result.status === 'rejected') {
52
+ console.error(`Failed to cache asset: ${CORE_ASSETS[i]}`, result.reason);
53
+ }
54
+ });
55
56
+ })
57
.then(() => self.skipWaiting())
58
);
59
});
0 commit comments