Skip to content
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

Flash of Unstyled Content while using customized _document #8

Closed
ithinco opened this issue Mar 24, 2019 · 3 comments
Closed

Flash of Unstyled Content while using customized _document #8

ithinco opened this issue Mar 24, 2019 · 3 comments

Comments

@ithinco
Copy link

ithinco commented Mar 24, 2019

It seems that the customized _document hasn't been attached to the renderOpts in renderToHTML function of next-server.

func renderToHTML(req, res, pathname, query, renderOpts) {}

I'm using "next": "8"

@kyle-mccarthy
Copy link
Owner

kyle-mccarthy commented Mar 26, 2019

Hi can you provide a little more information about how you are handling your styles? I use emotion 10 and haven't encountered this issue. I also don't directly call the renderToHTML method, I call render.

Can you also provide a sample of your _document file as well as checking out this issue from the nextjs repo?

@ithinco
Copy link
Author

ithinco commented Mar 27, 2019

Hi, @kyle-mccarthy I'm using material-ui and this _document.tsx setting. https://github.com/mui-org/material-ui/blob/next/examples/nextjs-next-with-typescript/pages/_document.tsx

BTW, Thanks for your work.

@kyle-mccarthy
Copy link
Owner

kyle-mccarthy commented Mar 27, 2019

Thanks for sending that over. Unfortunately it looks like the example they provided is wrong. The call renderPage directly from the context, rather than using the enhancer which can cause the flash reported in this issue on the nextjs repo.

I messed around with their material-next example a little bit and was able to get it working with the enhanceApp, here is the gist. However, it looks like V4 uses a new SSR API, so it isn't likely to work when they release V4 in a couple of days.

Since this isn't really related to this repo, and is more of a question about using material-ui with next I am going to close this issue. I encourage you to ask the material-ui devs about an alternative to calling renderPage directly, since other people probably are having the same issue. You may want to attach the nextjs issue (#5629) I referenced above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants