Open mysilkworld opened 2 years ago
It is always being called since we are registering it on page load, try removing the await and the window reload below it.
Also increase the time, check all warnings about workbox window and heuristic algorithm on docs.
It is always being called since we are registering it on page load, try removing the await and the window reload below it.
Also increase the time, check all warnings about workbox window and heuristic algorithm on docs.
It did't help. Every time the page is loaded, a promt is displayed. Even if there were no updates, but it works well in chrome.
@mysilkworld can you just try it removing the interval? try on private window, removing previous sw, you've how to do it here: https://vite-plugin-pwa.netlify.app/examples/#how-to-run-example-projects
I tried different settings and different times for the interval and always the same result.
are you awaiting 1 minute between changes?
check this entry on docs: https://vite-plugin-pwa.netlify.app/guide/periodic-sw-updates.html
are you awaiting 1 minute between changes?
in this example 5 minutes
check this entry on docs: https://vite-plugin-pwa.netlify.app/guide/periodic-sw-updates.html
Checked, but I don't register new service workers. Every 5 minutes I have to reload the page twice.
My code now
<script setup>
import { useRegisterSW } from 'virtual:pwa-register/vue'
import { AppButton } from '@gydeapp/components'
const intervalMS = 5 * 60 * 1000
const { needRefresh, updateServiceWorker } = useRegisterSW({
immediate: true,
onRegistered(r) {
r &&
setInterval(async () => {
await r.update()
}, intervalMS)
}
})
const close = async () => {
needRefresh.value = false
}
const reload = () => {
updateServiceWorker()
}
</script>
maybe it is a problem on Safari with the update
impl. (your code looks good)
is it working without the update
logic? I mean, making a change on the codebase and refreshing the page...
about the time is about changing the codebase not the interval, read the docs again, the gray box warning: you must await at least 1 minute between changes on your codebase (and build your app)
maybe it is a problem on Safari with the
update
impl. (your code looks good)is it working without the
update
logic? I mean, making a change on the codebase and refreshing the page...
Yes, it is working without the update
logic.
about the time is about changing the codebase not the interval, read the docs again, the gray box warning: you must await at least 1 minute between changes on your codebase (and build your app)
Yes, it is, I definitely wait longer than one minute
unfortunately I don't have my mac at hand, so I can't test what's going on (a nephew has it), maybe you can debug the workbox-window
library to check if it is a problem with the update
impl or something wrong with workbox-window
unfortunately I don't have my mac at hand, so I can't test what's going on (a nephew has it), maybe you can debug the
workbox-window
library to check if it is a problem with theupdate
impl or something wrong withworkbox-window
I don't have mac too, now. But will try to take it from a friend. I'll keep you informed
I have a colleague with the same problem, but this is ok for me. I think the problem is with older Safari versions
I have the same problem on IOS 16. On android or windows works fine, but on IOS 16 install the same service worker infinite times with infinite reload popup.
Maybe you can check if the sw is activated: https://github.com/elk-zone/elk/blob/main/modules/pwa/runtime/pwa-plugin.client.ts#L43
Hi, i have a problem. onRegistered callback is called promt again after reload, only in ios safary. Then the promt is displayed every minute.
vite.config.js
PromtRefresh.vue