-
- Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
I'm using create react app with react-snapshot to pre-render static markup for my routes. i.e "/", "/signIn", "/signUp"
generates index.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 a main.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 word home
(static markup for "/"
route) come up for a moment before the actual form for signIn renders.