Service Worker: Fix broken UI in Safari
This commit is contained in:
parent
8edc4f90a8
commit
894ea86f91
@ -7,11 +7,18 @@ export async function respondWithCache(e: FetchEvent) {
|
|||||||
const cached = await cache.match(e.request);
|
const cached = await cache.match(e.request);
|
||||||
|
|
||||||
if (cached) {
|
if (cached) {
|
||||||
return cached;
|
if (cached.ok) {
|
||||||
|
return cached;
|
||||||
|
} else {
|
||||||
|
await cache.delete(e.request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const remote = await fetch(e.request);
|
const remote = await fetch(e.request);
|
||||||
cache.put(e.request, remote.clone());
|
|
||||||
|
if (remote.ok) {
|
||||||
|
cache.put(e.request, remote.clone());
|
||||||
|
}
|
||||||
|
|
||||||
return remote;
|
return remote;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user