Excessive layout client component child rendering while waiting for page client component
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.5k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 334
Description
Link to the code that reproduces this issue
https://github.com/OblikStudio/test-nextjs/tree/issue-excessive-renders
To Reproduce
Here's the issue:
- Put a
use clientcomponent insidelayout.tsx - Put another
use clientcomponent insidepage.tsx - Make sure that the page JS chuck takes longer to load
- The layout child will excessively render until the page chunk loads
This is reproducible with a fresh installation of Next.js 16.1.6:
- Clone the repo
npm run buildnpm run start- Open Chrome DevTools
- Disable Cache
- Navigate to http://localhost:3000
- You'll see a bunch of logs "rendering LayoutChild"
- The logs stop only after seeing "rendering PageChild"
- If you enable network throttling, the issue gets worse
Here's what happens:
And here's a video:
https://github.com/user-attachments/assets/bfc1ffaa-0617-4e4f-ac31-5d644a76eb7d
Current vs. Expected behavior
Current behavior is that Next.js re-renders any client components inside a layout.tsx until the JS chunk for the corresponding route is downloaded. If for some reason this never happens (like blocking the request URL), Next.js gets stuck in an infinite loop.
Expected behavior is to render the layout child once and when the route chunk is downloaded — to render the page child.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Wed Nov 5 21:34:00 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_ARM64_T8132
Available memory (MB): 16384
Available CPU cores: 10
Binaries:
Node: 22.21.0
npm: 10.9.4
Yarn: N/A
pnpm: 10.19.0
Relevant Packages:
next: 16.1.6 // Latest available version is detected (16.1.6).
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: 5.9.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
React
Which stage(s) are affected? (Select all that apply)
next start (local)
Additional context
This is reproducible on Next.js 15.4.10 too. It's where I initially spotted the issue, in my actual app. I thought I was doing something wrong and was going crazy, until I stripped everything down to a couple of files and reproduced it in a fresh installation, and even on the latest version of Next as well.
It seems like there's some sort of race condition that makes React go crazy until the rest of the JS gets loaded. It was tricky to debug because the issue is affected by network conditions, so if you test locally and your JS chunk is small, the layout child will render just once, as expected. But if you turn on network throttling (or you put crap in your JS chunk to make it larger), you'll start seeing the issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce with the linked test-nextjs project, focusing on the client components in layout.tsx and page.tsx. Run npm run build and npm run start, then use Chrome DevTools with cache disabled and network throttling to observe repeated layout-child renders while the page chunk loads. Done means the layout child renders once and the page child renders after its chunk arrives, without an infinite loop if the request is blocked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, react
- Domain
- frontend, performance, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100