-
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
potential extraneous div surrounding #__next #822
Comments
cc @nkzawa |
I can see why this is happening and might be a tricky one to fix as because it utilises dangerouslySetInnerHTML it can't have a child which means we cant have the rendering element be the |
@alexnewmann Actually, we could move Next Data script to NextScript. |
good shout, i'll pick this up tonight after work! |
I'm still seeing this at several layers in 3.2.2: There are two extraneous layers until I get to the content (which is the main element I'm exporting). In order to have non-VH using full height content, I need to do something ridiculous like this:
|
I got the same this is a pain for full height components as noted by @yunyu and I'm running v4.0.3 |
@tgdn will merge the removal of all extra divs soon 👍 |
This is still an issue with Next.js 4 |
Fixed in #3327, will be released soon 👍 |
So the |
Could we have the option to remove |
React needs a nested root. It can't render inside |
Stats from current PRDefault Server ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Rendered Page Sizes
Serverless ModeGeneral
Client Bundles (main, webpack, commons)
Client Bundles (main, webpack, commons) Modern
Client Pages
Client Pages Modern
Client Build Manifests
Serverless bundles
Commit: a918d4e |
Hey guys, so I've just started using next.js on version 1 and decided to try out version 2 tonight so I could use some of the document stuff. I upgraded and noticed, before implementing a custom document, that there is an extra div now rendering around the
#__next
element.Below are some images of the issue:
Before 1.x.x
After 2.x.x ^
It appears the line was added here https://github.com/zeit/next.js/blob/master/server/document.js#L73
whereas it used to be like
https://github.com/zeit/next.js/blob/43b0e6f51420325abf2aed1157a197392364b25d/lib/document.js#L16
So it looks like its because now its rendering as its own component, instead of being nested inside
html
, wondering if we could instead make the containing element the__next
element, and put the following line (https://github.com/zeit/next.js/blob/master/server/document.js#L75) within the__next
component?Reason being, theres an extra div now that seems pointless, its creating further nests for CSS if you want to make body a flex container as you need to propagate down until
__next
to match the width/height dimensions of body plus it will give cleaner markup.I'm up for hearing suggestions/discussions around this and would be willing to help fix this issue, in the mean time I will have a play around and see what i can come up with.
Cheers!
The text was updated successfully, but these errors were encountered: