Service Workers - Consolidated issues list
See original GitHub issueThis is a consolidation of issues and fixes service workers in CRA.
For general discussion of service workers see issue #2398
Last updated: 18/06/2017 00:10:00 GMT
- SWI1: Service workers are causing CRA to show up when someone hosts a non CRA app on the same
address:host
.
PR #2551 attempt to address this by auto reloading non-service worker apps.
- SWI2 User sees old app when revisiting a site, they must refresh to see the updated site.
PR #2426 attempts to address by showing a toast notifying user to refresh.
- SWI3 service-worker.js can be cached accidently or by default on some hosts, meaning that new versions of apps do not appear until the cache period ends.
Eventually browsers should force no-cache on service workers, but this is only implemented in firefox currently. In the mean time, only fix is to ensure no-cache is set on service-worker.js SW Spec Issue, Firefox ✔, Chrome ✘
PR #2563 is a proof of concept how this could be addressed in CRA.
- SWI4 Browser support is currently patchy. Different browsers support different specs and there is no polyfills to align browsers, things means developers need to be aware of browser differences
There is currently no fix for this.
- SWI5 Odd behaviour for the end users when an app is cached but no data is loaded, images don’t load etc
There is currently no fix for this. Developers must know of this behaviour an plan for it. Due to the fact users aren’t allowed to fully configure the service worker, they won’t ever be able to cache API data and images (I think? @jeffposnick).
A developer can store data in localStorage
and load that initially / if offline.
- SWI6 When
registerServiceWorker.js
is updated to fix issues, it will not be updated for current users of CRA. Breaking the ‘as long as you don’t eject you always have the latest features’
Currently no PR but we could move the logic out of registerServiceWorker.js and add it to react-scripts
config folder.
Please feel free to add any issues that you have encounter using CRA with service workers enabled.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:34 (22 by maintainers)
Top GitHub Comments
We’re moving forward with making service-workers opt in in the next major release. They’re still readily available behind a single line change but won’t be registered by default.
https://github.com/facebookincubator/create-react-app/pull/3817
I hope this is a satisfactory conclusion for most users. We can revisit this in a year or two.
👍
Bikeshedding, but as a developer something like
Sounds like a neat way to solve the problem without breaking existing behaviour but giving an easy way to nuke the serviceWorker for those that upgrade with minimal code changes. I can send a PR for this if wanted 🐈