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

next/dynamic with SSR doesn't preload with functional _document component #31765

Closed
sam3d opened this issue Nov 24, 2021 · 2 comments
Closed
Labels
bug Issue was opened via the bug report template.

Comments

@sam3d
Copy link
Contributor

sam3d commented Nov 24, 2021

What version of Next.js are you using?

12.0.4

What version of Node.js are you using?

16.10.0

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

Vercel

Describe the Bug

There is a hydration error when using Next.js functional document component instead of class-based Document. It shows "Loading" when it should show the component. It works properly when using the standard class based _document

Expected Behavior

The page doesn't have a flash of the component loader

To Reproduce

https://github.com/sam3d/next-hydration-bug

@sam3d sam3d added the bug Issue was opened via the bug report template. label Nov 24, 2021
@thibautsabot
Copy link
Contributor

Hey!

It seems that _document is intended to use class component (see: #26423).

This PR, allows for a very basic example to work with functional component but this comment:

It's highly likely that anything more sophisticated than the following example will be broken by a future version of Next.js:

suggests that it's probably better to stick to class component when you can.

@sam3d sam3d closed this as completed Nov 23, 2022
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants