-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Add suppressHydrationWarning for nextJS #1335
Conversation
Using darkMode can lead to an hydratation warning. As described in nextjs doc `While rendering your application, there was a difference between the React tree that was pre-rendered from the server and the React tree that was rendered during the first render in the browser (hydration).` https://nextjs.org/docs/messages/react-hydration-error https://github.com/pacocoursey/next-themes?tab=readme-ov-file#with-app
Run & review this pull request in StackBlitz Codeflow. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis update introduces the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- apps/web/content/docs/guides/next-js.mdx (2 hunks)
Additional Context Used
Additional comments not posted (2)
apps/web/content/docs/guides/next-js.mdx (2)
149-149
: AddingsuppressHydrationWarning
to thehtml
element in theRootLayout
function is a direct approach to suppress hydration warnings. However, it's important to ensure that this does not mask other potential issues in your application. Use this property judiciously and only when you're certain that the hydration mismatches are intentional and harmless.
168-168
: Similarly, addingsuppressHydrationWarning
to theHtml
component in theDocument
function is an effective way to suppress hydration warnings. As with the previous comment, ensure that this approach is used carefully to avoid overlooking other discrepancies between server and client renders that could affect your application's behavior or performance.
Using darkMode can lead to an hydratation warning.
As described in nextjs doc
While rendering your application, there was a difference between the React tree that was pre-rendered from the server and the React tree that was rendered during the first render in the browser (hydration).
https://nextjs.org/docs/messages/react-hydration-error
https://github.com/pacocoursey/next-themes?tab=readme-ov-file#with-app
Summary by CodeRabbit
RootLayout
andDocument
components.