clear sw-cache if localhost or new version (#2242) by lukew3

This commit is contained in:
Luke Weiler 2022-01-03 06:23:20 -05:00 committed by GitHub
parent f8c27c66a6
commit 3262a3bbe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,7 +15,11 @@ export async function show(version) {
setMemory(version);
return;
}
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
caches.delete('sw-cache');
}
if (memory === version) return;
caches.delete('sw-cache');
Notifications.add(
`Version ${version} has been released. Click to view the changelog.`,
1,