scalable-react-typescript-boilerplate icon indicating copy to clipboard operation
scalable-react-typescript-boilerplate copied to clipboard

Fix FOUC server rendered Styled-components

Open RyanCCollins opened this issue 8 years ago • 2 comments

I am not sure why, but the server-rendering of styled-components seems to fail. This is working on scalable-react-boilerplate (located here). It must be a regression in styled-components.

RyanCCollins avatar Feb 21 '17 03:02 RyanCCollins

What makes you think this is failing? I see the raw HTML using "View page source" when running the Production server. Is there a specific page/component that you are looking at?

I agree there is no server side rendering in the dev environment.

sfleck avatar Feb 25 '17 04:02 sfleck

When you transition to a new route whose bundle is not yet loaded on the prod site, you will see a flash of unstyled content. I have it configured to inject the styles from the site into the head, but for some reason it misses it on the initial server-render.

I will post a link to the production site. Just a moment.

EDIT: it looks like this is only happening on full reload now because we are using react-router behind the scenes for page transitions.

RyanCCollins avatar Feb 25 '17 06:02 RyanCCollins