Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Introduce app-root #5423
Introduce app-root #5423
Changes from all commits
28c39fc
a6c405f
ef0cbcc
1646fca
495aa02
cc8bf03
75180ee
c6355b1
b258ac7
afcb090
9ad5bad
41f1913
593ad9b
f196da1
1c02628
98dc8e1
eaef472
0647d78
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, so the server sends an unstyled page to the browser, then styles are built in the client?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe not. The downloaded HTML includes an inline stylesheet. Vendor prefixes can definitely be removed here.
If we could move all this into an external CSS file, that would cost us less to build and serve, but I don't think that's possible with styled components and Next.js. At the moment, the server has to rebuild the CSS whenever the page is rebuilt (#3380), so whenever content changes. However, the CSS only changes once a week, when we deploy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 this stylesheet fixes the page styling issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breakpoints should be
48rem
, not768px
, but that's probably a bug in the Grommet theme.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is odd. I built the app a second time. After the second build, I don't see the server-side stylesheet in the HTML, so it's unstyled again when it first loads.
Screen.Recording.2023-10-02.at.12.59.12.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems ok after running the bootstrap script and building for a third time. 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know, thanks for double checking!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hook name is confusing in a client-side component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this is a client component, you noted earlier the downloaded HTML includes an inline stylesheet. Client components still run once on the server, and then again in the browser. This code is copied from the styled-components example: https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components
Do you recommend changing the function name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hook's name is set by Next.js, so that's fine. I was just confused as to how this component works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This checks if the code is running in a browser, but the file specifies
use client
, so that's confusing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also a bit confused. I used the example from https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components, but don't totally understand why this line is included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know I'm not the only one that's confused by how this works. 😄