Skip to content

Commit 0417361

Browse files
Update app/public/service-worker.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 40f425f commit 0417361

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/public/service-worker.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,17 @@ self.addEventListener('install', (event) => {
4343
event.waitUntil(
4444
caches
4545
.open(PRECACHE)
46-
.then((cache) => Promise.allSettled(CORE_ASSETS.map((asset) => cache.add(asset))))
46+
.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+
})
4757
.then(() => self.skipWaiting())
4858
);
4959
});

0 commit comments

Comments
 (0)