fix(pwa): 🐛 replace Promise.race by Promise.any

This commit is contained in:
Julien Oculi 2024-07-18 16:30:02 +02:00
parent 79c0d49cad
commit 32732be3b5
2 changed files with 3 additions and 3 deletions

View file

@ -139,7 +139,7 @@ async function fetchHandler(event: FetchEvent) {
throw new Error(`no cache available for pre-cached-url "${url}"`)
})
return Promise.race([
return Promise.any([
FetchStrategy.fastestAndCacheRefresh(preCache, event, ac),
preCachedNoSearch,
])

View file

@ -35,7 +35,7 @@ export class FetchStrategy {
})
// Get fastest
return Promise.race([cachedOrError, fetchedAndCached])
return Promise.any([cachedOrError, fetchedAndCached])
}
static networkOnly(
@ -64,7 +64,7 @@ export class FetchStrategy {
return response
})
return Promise.race([preload, fetched])
return Promise.any([preload, fetched])
}
}