mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-18 18:59:15 +08:00
fix: udpate pwa site when needRefresh(sw.js updated), for cloudflare static cache
This commit is contained in:
parent
ea04c255c3
commit
3d7b49d991
@ -4,7 +4,7 @@ import { useToast } from "./useToast"
|
||||
|
||||
export function usePWA() {
|
||||
const toaster = useToast()
|
||||
const { updateServiceWorker } = useRegisterSW()
|
||||
const { updateServiceWorker, needRefresh: [needRefresh] } = useRegisterSW()
|
||||
|
||||
useMount(async () => {
|
||||
const update = () => {
|
||||
@ -21,7 +21,7 @@ export function usePWA() {
|
||||
},
|
||||
},
|
||||
})
|
||||
} else {
|
||||
} else if (needRefresh) {
|
||||
if (!navigator) return
|
||||
|
||||
if ("connection" in navigator && !navigator.onLine) return
|
||||
|
Loading…
x
Reference in New Issue
Block a user