-
-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serviceworker - cache API response #4147
Comments
I think it's better if you start using Workbox. It's a tool create by google as a forerunner to sw-precache-plugin which CRA currently uses. Also, this will be an opt-in feature in the next release, so it's better if you learn and implement it yourself. Here are some resources and links that I gathered while learning about Service Worker APIs. Intro: https://developers.google.com/web/tools/workbox/ ** UPDATE ** |
@metju90 @mohit-github I created an npm package that solves this issue without ejecting/forking https://www.npmjs.com/package/react-app-rewire-workbox . |
One of the benefits of create-react-app is to develop and an application which requires zero config. I understand why they are not happy with the required config. Thanks for this @davejm |
I have a follow-up question relating to this (maybe this resides in StackOverflow). If your API is hosted on the same origin as your static website, do all GET api calls get cached? For example my static site might be served from https://example.com and my api is at https://example.com/api. The documentation says sw will not intercept or cache any cross-origin traffic like HTTP API-requests. In my scenario, since the api isn't technically cross-origin, will my api calls be cached? |
This is an app level concern and not something which would be a good default for all of our users, I can pretty confidently say this isn't something that we'll be exploring. |
I've been searching online with no success to see if its possible to cache certain API's responses in order to have a further functional offline site.
If this is already in place, can someone link me to its documentation? if there isn't, I think it would be a great feature to have.
The text was updated successfully, but these errors were encountered: