You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deploy an app that is somehow buggy. Even best dev make mistakes
A client access the app via your favourite browser (which is probably supporting cache api and service worker). Your app is cached by service worker (sw).
Redeploy your app with correction
Same client access the app via the same browser by pressing f5. He's getting the sw cached version.
Note that if client closes its tabs, browser ... then access the app, he will get the new version. This is related to the new deployment which generates a new sw.js file. This file will be executed by service worker but because of sw lifecycle, it will be used only when all clients stop using the previous one
- Use case 2 : Subsequent deployments
Deploy an app
A client access the app via his favourite browser (which is probably supporting cache api and service worker). Your app is cached by service worker (sw).
Redeploy your app with correction, improvements. Hey, aren't we suppose to push continously (CI/CD)
Same client access the app via the same browser by pressing f5. He's getting the sw cached version.
Note that if client closes its tabs, browser ... then access the app, he will get the new version. This is related to the new deployment which generates a new sw.js file. This file will be executed by service worker but because of sw lifecycle, it will be used only when all clients stop using the previous one
Steps to reproduce
Nothing in particular
Expected behavior
I think we should discuss the offlinePlugin configuration of webpack.
This plugins generates a sw.js file which contains the caching strategy that will be executed by browsers service workers.
I think we should discuss the caching we want and either adapt the offlinePlugin configuration or generate a custom sw strategy.
From my point a view, last version deployed should always be served first as it contains improvements, bugs corrections, ... Maybe you guys have other point of view ?
One simple way of doing this would probably be to exclude index.html from the sw configuration (I think this can be done by adding index.html next to the .htaccess in the configuration of the plugin - I'll check that and let you know).
Another way could be to configure the plugin to autoUpdate more frequently that 24 hours (which is the default caching time) .
Another way could be to configure the sw with skipWaiting feature. This does not seems to be supported by offlinePlugin
By the way, this link explains very well the differences in refresh scenarios (F5, CTRL+F, ...)
Versions
React-Boilerplate: latest
Node/NPM: latest
Browser: chrome latest
The text was updated successfully, but these errors were encountered:
Description
- Use case 1 : Buggy app
- Use case 2 : Subsequent deployments
Steps to reproduce
Nothing in particular
Expected behavior
I think we should discuss the offlinePlugin configuration of webpack.
This plugins generates a sw.js file which contains the caching strategy that will be executed by browsers service workers.
I think we should discuss the caching we want and either adapt the offlinePlugin configuration or generate a custom sw strategy.
From my point a view, last version deployed should always be served first as it contains improvements, bugs corrections, ... Maybe you guys have other point of view ?
By the way, this link explains very well the differences in refresh scenarios (F5, CTRL+F, ...)
Versions
The text was updated successfully, but these errors were encountered: