fix(ui): remove index.html from service worker cache after creating admin user (#3642)

This commit is contained in:
Kendall Garner
2025-01-12 23:32:02 +00:00
committed by GitHub
parent 3179966270
commit 920fd53e58
3 changed files with 24 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
export const removeHomeCache = async () => {
try {
const workboxKey = (await caches.keys()).find((key) =>
key.startsWith('workbox-precache'),
)
if (!workboxKey) return
const workboxCache = await caches.open(workboxKey)
const indexKey = (await workboxCache.keys()).find((key) =>
key.url.includes('app/index.html'),
)
if (indexKey) {
await workboxCache.delete(indexKey)
}
} catch (e) {
// eslint-disable-next-line no-console
console.error('error reading cache', e)
}
}