Added bugfix to SW for DevTools

This commit is contained in:
Eduard Urbach 2018-04-17 21:21:03 +02:00
parent a2d6aec1f0
commit f0007f9438
3 changed files with 7 additions and 1 deletions

View File

@ -16,7 +16,7 @@ func configureAssets(app *aero.Application) {
scriptBundle := js.Bundle() scriptBundle := js.Bundle()
// Service worker // Service worker
serviceWorkerBytes, err := ioutil.ReadFile("sw/service-worker.js") serviceWorkerBytes, err := ioutil.ReadFile("scripts/ServiceWorker/ServiceWorker.js")
serviceWorker := string(serviceWorkerBytes) serviceWorker := string(serviceWorkerBytes)
// CSS bundle // CSS bundle

View File

@ -112,6 +112,12 @@ class MyServiceWorker {
return return
} }
// DevTools opening will trigger these "only-if-cached" requests.
// https://bugs.chromium.org/p/chromium/issues/detail?id=823392
if((evt.request.cache as string) === "only-if-cached" && evt.request.mode !== "same-origin") {
return
}
// Fetch via network // Fetch via network
return evt.respondWith(fetch(evt.request)) return evt.respondWith(fetch(evt.request))