fix(pwa): 🐛 replace Promise.race by Promise.any
This commit is contained in:
parent
79c0d49cad
commit
32732be3b5
|
|
@ -139,7 +139,7 @@ async function fetchHandler(event: FetchEvent) {
|
||||||
throw new Error(`no cache available for pre-cached-url "${url}"`)
|
throw new Error(`no cache available for pre-cached-url "${url}"`)
|
||||||
})
|
})
|
||||||
|
|
||||||
return Promise.race([
|
return Promise.any([
|
||||||
FetchStrategy.fastestAndCacheRefresh(preCache, event, ac),
|
FetchStrategy.fastestAndCacheRefresh(preCache, event, ac),
|
||||||
preCachedNoSearch,
|
preCachedNoSearch,
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export class FetchStrategy {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Get fastest
|
// Get fastest
|
||||||
return Promise.race([cachedOrError, fetchedAndCached])
|
return Promise.any([cachedOrError, fetchedAndCached])
|
||||||
}
|
}
|
||||||
|
|
||||||
static networkOnly(
|
static networkOnly(
|
||||||
|
|
@ -64,7 +64,7 @@ export class FetchStrategy {
|
||||||
return response
|
return response
|
||||||
})
|
})
|
||||||
|
|
||||||
return Promise.race([preload, fetched])
|
return Promise.any([preload, fetched])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue