Always reload when making network request
This commit is contained in:
parent
62fefcae2d
commit
481ff1da24
1 changed files with 7 additions and 3 deletions
10
sw.js
10
sw.js
|
@ -1,4 +1,4 @@
|
|||
const VERSION = 'v17'
|
||||
const VERSION = 'v18'
|
||||
|
||||
const CACHE_FIRST = [
|
||||
// Root
|
||||
|
@ -174,7 +174,9 @@ const cacheFirst = async ({ request, preloadResponsePromise, refreshAnyway }) =>
|
|||
}
|
||||
|
||||
// Next try to get the resource from the network
|
||||
const responseFromNetwork = await fetch(request)
|
||||
const responseFromNetwork = await fetch(request, {
|
||||
cache: 'reload',
|
||||
})
|
||||
// response may be used only once
|
||||
// we need to save clone to put one copy in cache
|
||||
// and serve second one
|
||||
|
@ -212,7 +214,9 @@ const networkFirst = async ({ request, preloadResponsePromise }) => {
|
|||
let responseFromNetwork
|
||||
let errorFromNetwork
|
||||
try {
|
||||
responseFromNetwork = await fetch(request)
|
||||
responseFromNetwork = await fetch(request, {
|
||||
cache: 'reload',
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
responseFromNetwork = null
|
||||
|
|
Loading…
Add table
Reference in a new issue