8000 docs: clarify root layout requirements and `suppressHydrationWarning` usage with App Router by boutterudy · Pull Request #1927 · amannn/next-intl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

docs: clarify root layout requirements and suppressHydrationWarning usage with App Router #1927

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

boutterudy
Copy link
Contributor

❓ Context

While working with next-intl and the App Router, I ran into hydration warnings due to <html> and <body> tags being duplicated in app/layout.tsx and app/[locale]/layout.tsx:

Error: Missing <html> and <body> tags in the root layout. 

This issue was hard to track down until I found issue #1385, which explains the cause but doesn't currently link to a fix in the documentation.

✅ What This PR Does

This PR updates the documentation to:

  • Clarify that <html> and <body> must exist in both layouts
  • Show how to prevent hydration warnings by adding suppressHydrationWarning
  • Provide full examples for both app/layout.tsx and app/[locale]/layout.tsx

✨ Wonderful Result

image

Copy link
vercel bot commented Jun 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2025 9:34pm
next-intl-example-app-router-without-i18n-routing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2025 9:34pm

Copy link
vercel bot commented Jun 19, 2025

@boutterudy is attempting to deploy a commit to the next-intl Team on Vercel.

A member of the Team first needs to authorize it.

@amannn
Copy link
Owner
amannn commented Jun 23, 2025

If you want to add a layout at the root, it shouldn't include tags like html, but simply return children (see the docs).

Based on my latest tests, this layout is not strictly required, but for a not-found.js file at the root, it currently is.

Note that this will change in the near future though: global-not-found.js

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

Successfully merging this pull request may close these issues.

2 participants
0