-
-
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
Pre-rendering with react-snapshot and service worker incorrect behavior #3132
Comments
@jeffposnick any suggestions to resolve this? asking since I believe this is related to SW |
Are you storing your rendered HTML snapshots in I'm assuming that you've already |
@jeffposnick the pre-rendered HTML snapshots by And I have not ejected from create-react-app, since |
Hello @jasan-s—The service worker that's generated during the Any navigation request for a URL that isn't precached will result in the cached contents of Since you're already effectively customizing the build process, your best bet might actually be to run |
Thanks @jeffposnick I will try that. In create react app the |
The For the output path, the CLI uses a parameter named I think the idea is that if you chain So you'd use
where |
@jeffposnick successfully caching all the folders using the following config 👍
However, Now for some reason on Update: I can confirm This is due to browser caching Locally I'm using
|
@jeffposnick with the CRA 2.0 can you provide an update to how to acheive the same custom config using |
See #5359 regarding custom Workbox configs in c-r-a 2.0. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
I'm using create react app with react-snapshot to pre-render static markup for my routes. i.e
"/", "/signIn", "/signUp"
generatesindex.html, signIn.html, signUp.html
respectively.However what I'm seeing is that if I go to any route my app serves
index.html
(the static markup for the root route"/"
) momentarily and then renders the actual static markup(from react-snapshot) for the route (see the gif). This behevior makes sense if I was serving the app entirely from amain.js
bundle , but since I want to use the static pre-generated html files, how do I disable the the service worker from serving index.html on certain routes for which I have static html file already.Update: If I remove service worker from the create react app, the app loads static file for the path fine. However, I want to keep the functionality of service worker for PWA features.
Update 2: On
chrome browser
the quick flicker of root route static markup happens only once for each route. After the 1st flicker it seems the chrome browser cache fixes it, additionally if I disable cache from chrome dev tools and try to go to new route the flicker of root route returns.On
Firefox browser
the problem exists no matter what, on every route change or refresh the momentary flick of root route static markup occurs.posted this on stackoverflow as well:
GiF shows me trying to access
"/signIn"
Route, and notice the wordhome
(static markup for"/"
route) come up for a moment before the actual form for signIn renders.The text was updated successfully, but these errors were encountered: