2
votes

I have a Flutter web app that is deployed on Firebase Hosting. When deploying a new version Safari does not pick up the new version even when doing refresh. I assume this is due to the installed service worker, that will serve the old content. How can one bypass this problem? I know that a hard refresh solves the problem, but that is not a good solution as we cannot expect the users to know to do that.

One alternative that requires client code, would be that I track the current version of the app that is currently loaded, and if that change I create "New version available" screen when I detect that a new version is available, and perform a location.reload(true) call from the client to bypass cache and get the new service worker installed.

Any other options?

1
I have the same problem with react, even without a service worker running. Did you find a solution for this? - Daniel Szy
did you increase the version in index file of web folder of your flutter project ? I have the same issue i just increased the version of JS file in which is in index.html in web folder. - hiashutoshsingh

1 Answers

2
votes

In more recent versions, they are appending a random hash on every build to the flutter_service_worker.js URL so it should break the cache and refresh properly.