-
-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updateServiceWorker always reload the page #779
Comments
Check out the examples folder, such as https://github.com/vite-pwa/vite-plugin-pwa/blob/v0.21.0/examples/preact-router/src/ReloadPrompt.tsx |
That demo still do not let me install the service worker unless the click accept which reload the page See my comment:
I can achieve that if |
I'd say that it's doing exactly what you'd it like to do You can write your own patched |
Well, no, as mentioned the demo force you to reload when you accept the changes,
What I want is the following:
do you mean I should patch the npm package ? or is there a way to override the regiser function so that it do not force reload upon accepting the new sw version ? |
By patching I mean:
Or even better: This could potentially fix #498 |
Currently in the code
vite-plugin-pwa/src/client/build/register.ts
Line 62 in 2de47c4
vite-plugin-pwa/src/client/build/register.ts
Line 87 in 2de47c4
vite-plugin-pwa/src/client/build/register.ts
Line 102 in 2de47c4
once the service worker is installed, after calling
updateServiceWorker
the page reloadThis is unfortunate as the flow I want for my user is as follow
once a new service worker is detected, I want it installed as soon as possible. Then I ask the user if they want to reload the page to get the new version. If they close, they can continue, but if they reload manually later, I want them to have the new version
updateServiceWorker automatic reload prevent me to do that and so when a user reload they keep getting the message to update until they click "reload". which is not what I want
An option to not reload automatically would be great
The text was updated successfully, but these errors were encountered: