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 = [
|
const CACHE_FIRST = [
|
||||||
// Root
|
// Root
|
||||||
|
@ -174,7 +174,9 @@ const cacheFirst = async ({ request, preloadResponsePromise, refreshAnyway }) =>
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next try to get the resource from the network
|
// 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
|
// response may be used only once
|
||||||
// we need to save clone to put one copy in cache
|
// we need to save clone to put one copy in cache
|
||||||
// and serve second one
|
// and serve second one
|
||||||
|
@ -212,7 +214,9 @@ const networkFirst = async ({ request, preloadResponsePromise }) => {
|
||||||
let responseFromNetwork
|
let responseFromNetwork
|
||||||
let errorFromNetwork
|
let errorFromNetwork
|
||||||
try {
|
try {
|
||||||
responseFromNetwork = await fetch(request)
|
responseFromNetwork = await fetch(request, {
|
||||||
|
cache: 'reload',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
responseFromNetwork = null
|
responseFromNetwork = null
|
||||||
|
|
Loading…
Add table
Reference in a new issue