add null check for index.html fetch in SW (#484)
hopefully should fix #483
This commit is contained in:
parent
91a92b0003
commit
8d2e0636d6
|
@ -83,7 +83,10 @@ self.addEventListener('fetch', event => {
|
||||||
// for routes, serve the /index.html file from the most recent
|
// for routes, serve the /index.html file from the most recent
|
||||||
// assets cache
|
// assets cache
|
||||||
if (routes.find(route => route.pattern.test(url.pathname))) {
|
if (routes.find(route => route.pattern.test(url.pathname))) {
|
||||||
return caches.match('/index.html')
|
let response = await caches.match('/index.html')
|
||||||
|
if (response) {
|
||||||
|
return response
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue