[flutter_tools] switch cache mode to reload (#62076)

This commit is contained in:
Jonah Williams 2020-07-29 21:26:03 -07:00 committed by GitHub
parent 210f7680fc
commit 234d8fac4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -413,8 +413,8 @@ const CORE = [
self.addEventListener("install", (event) => {
return event.waitUntil(
caches.open(TEMP).then((cache) => {
// Provide a no-cache param to ensure the latest version is downloaded.
return cache.addAll(CORE.map((value) => new Request(value, {'cache': 'no-cache'})));
// Provide a 'reload' param to ensure the latest version is downloaded.
return cache.addAll(CORE.map((value) => new Request(value, {'cache': 'reload'})));
})
);
});
@ -497,7 +497,7 @@ self.addEventListener("fetch", (event) => {
// Either respond with the cached resource, or perform a fetch and
// lazily populate the cache. Ensure the resources are not cached
// by the browser for longer than the service worker expects.
var modifiedRequest = new Request(event.request, {'cache': 'no-cache'});
var modifiedRequest = new Request(event.request, {'cache': 'reload'});
return response || fetch(modifiedRequest).then((response) => {
cache.put(event.request, response.clone());
return response;