Skip to content

Commit 7255a60

Browse files
gaearonkasperpeulen
authored andcommitted
Add explicit "Opting Out of Caching" header (facebook#2822)
1 parent 86a97db commit 7255a60

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/react-scripts/template/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
6868
- [Getting Started with Storybook](#getting-started-with-storybook)
6969
- [Getting Started with Styleguidist](#getting-started-with-styleguidist)
7070
- [Making a Progressive Web App](#making-a-progressive-web-app)
71+
- [Opting Out of Caching](#opting-out-of-caching)
7172
- [Offline-First Considerations](#offline-first-considerations)
7273
- [Progressive Web App Metadata](#progressive-web-app-metadata)
7374
- [Analyzing the Bundle Size](#analyzing-the-bundle-size)
@@ -1558,6 +1559,8 @@ The service worker will use a [cache-first strategy](https://developers.google.c
15581559
for handling all requests for local assets, including the initial HTML, ensuring
15591560
that your web app is reliably fast, even on a slow or unreliable network.
15601561
1562+
### Opting Out of Caching
1563+
15611564
If you would prefer not to enable service workers prior to your initial
15621565
production deployment, then remove the call to `serviceWorkerRegistration.register()`
15631566
from [`src/index.js`](src/index.js).
@@ -1567,7 +1570,8 @@ have decided that you would like to disable them for all your existing users,
15671570
you can swap out the call to `serviceWorkerRegistration.register()` in
15681571
[`src/index.js`](src/index.js) with a call to `serviceWorkerRegistration.unregister()`.
15691572
After the user visits a page that has `serviceWorkerRegistration.unregister()`,
1570-
the service worker will be uninstalled.
1573+
the service worker will be uninstalled. Note that depending on how `/service-worker.js` is served,
1574+
it make take up to 24 hours for the cache to be invalidated.
15711575
15721576
### Offline-First Considerations
15731577

0 commit comments

Comments
 (0)