vite-pwa/vite-plugin-pwa

Prompt- Reload - not reloading

elvince opened this issue · 4 comments

Hi,

Thanks for this plugin.

I follow all the instructions and look at your react samples on how to implement the update prompt.
Everything is working as expected except the "reload" part.
When I call updateServiceWorker(true), nothing hapenned. I had to call window.location.reload(); for the refresh to happenned.
Without the reload part, even a "normal F5 refresh" was not working as if the worker was in a waiting state and can't move out of it.

Any hints?

Just in case it helps, during the build I had a warning on my main js file that won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.

Thanks,

Try to provide a minimal reproduction, you can use the new create-pwa https://vite-pwa-org.netlify.app/guide/scaffolding.html

About the warbing : https://vite-pwa-org.netlify.app/guide/faq.html

Hi,
Sorry for the later answer.
I already followed your documentation.

I'm not able to recreate a repro project as the issue is not 100% reproductible.
What I observed is that our main index.js file is pretty huged (few Mb), and when an update is released, the browser worker service is 'in waiting' state forever.

It happened when you already opened the app or when you load the app.
For example:
I'm in V0, i closed the tab browser, I push a V1, I reopen the tab browser and I have a gray screen.
If I look at the the netwrok panel, the indexXXXXX.js is in 404 (because the hash has changed) and the worked is in "waiting". As a consequence our users are stuck. F5/Refresh does not change anything, you must do a CTRL+ F5 or close/reopen your browser for the app to work.

Any idea?

My 2 cents:
It sound like the events sequence because update/refresh, waiting is failing somewhere and that's why we are stuck forever.
It might be due to the fact that the index file is not cached (due to its size), so something is not working as expected in the event sequence. No cache, means you might try to read the file, but it doesn't exist (404) as the hash changed and it stuck somewhere?

thanks for your insight.

@elvince, have you solved it? Cause our index.js is 2.5MB and reload (prompt setting) does not work either.

@mpaland any asset greater than 2MiB won't be added to the sw precache, check https://vite-pwa-org.netlify.app/guide/faq.html#missing-assets-from-sw-precache-manifest