Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Avoid cache when updating SW, for now

Jake Archibald1c7486056da4
diff --git a/src/sw/util.ts b/src/sw/util.ts
index 60631460..8579aa59 100644
--- a/src/sw/util.ts
+++ b/src/sw/util.ts
@@ -84,14 +84,19 @@ export function cleanupCache(
);
}
+function urlsToRequests(urls: string[]): Request[] {
+ // Using no-cache, as our hashing aren't updating properly right now.
+ return urls.map((url) => new Request(url, { cache: 'no-cache' }));
+}
+
export async function cacheBasics(cacheName: string) {
const cache = await caches.open(cacheName);
- return cache.addAll(initial);
+ return cache.addAll(urlsToRequests(initial));
}
export async function cacheAdditionalProcessors(cacheName: string) {
const cache = await caches.open(cacheName);
- return cache.addAll(await theRest);
+ return cache.addAll(urlsToRequests(await theRest));
}
const nextMessageResolveMap = new Map<string, (() => void)[]>();