jsakamoto / Toolbelt.Blazor.PWA.Updater

Provide "Update Now" UI and feature to your Blazor PWA that appears when the next version of one is available.
Mozilla Public License 2.0
136 stars 7 forks source link

Sometimes it doesn't work well #14

Open thenhthang opened 1 year ago

thenhthang commented 1 year ago

Hello jsakamoto. Thank you for sharing. I have used this library in my application. I have the following problem: Sometimes it doesn't update automatically right away. I press Ctr+F5 to update to the new version, but after shutting down and reopening it, it's still the old version. Until the update notification appeared (about 30 minutes after publishing), I pressed update to upgrade to the new version, I tried shutting down the application and reopening it, the application was still the new version. I want to ask:

  1. I press Ctrl+F5 to upgrade, after shutting down and reopening, it's still the old version
  2. Sometimes the auto updater has to wait a long time (30 minutes or more) for the update message to appear, I press F5 and the update message still doesn't appear. Have you had a similar problem.
kimpadkjaer commented 1 year ago

I'm having the same issue.

Any news?

Botaa commented 1 year ago

I have the same issue in my WASM project, let me know if you figured it out.

jcadafalch commented 12 months ago

Same here with my WASM project.

Any news?

jsakamoto commented 11 months ago

Hi everyone, Unfortunately, in my experience, I have not succeeded in reproducing the problem everyone reported yet.

But anyway, could someone try the code change below and give us the report on whether the changes resolve your problem?

If you could, please change your fallback page, such as "index.html", by replacing the line below:

<script src="_content/Toolbelt.Blazor.PWA.Updater.Service/script.min.js"></script>

with:

<script src="_content/Toolbelt.Blazor.PWA.Updater.Service/script.min.js" no-register></script>
<script>
    navigator.serviceWorker.register('service-worker.js', { updateViaCache: 'none' }).then(registration => {
        Toolbelt.Blazor.PWA.Updater.handleRegistration(registration);
    });
</script>

I suspect the problem is related to the browser's caching for the "service-wroker.js".

And, another reason that I could come up with is that the problem might be related to the CDN. I would appreciate it if you could provide the information on where you deployed your Blazor Wasm app, such as GitHub Pages, Azure App Service, Amazon S3, etc.