Replies: 2 comments 1 reply
|
This is a really common frustration with the App Router. The issue is that in the App Router, any route with a dynamic segment (
Here are a couple things you can try:
The Pages Router handled this more intuitively because it didn't mix server/client boundaries the same way. Hope this helps! |
|
The Why dynamic routes always fire
|
| Approach | Eliminates _rsc? |
Works with unknown IDs? |
|---|---|---|
generateStaticParams |
✅ Yes | ❌ No (only known IDs) |
| Lightweight layouts | ❌ No, but much faster | ✅ Yes |
loading.tsx skeleton |
❌ No, but invisible | ✅ Yes |
<Link prefetch> |
❌ No, but pre-fetched | ✅ Yes |
Query params (?id=) |
✅ Yes | ✅ Yes (but changes URL structure) |
For a Tanstack Query app with unknown IDs at build time, the best combination is lightweight layouts + loading.tsx + <Link prefetch>. This makes the _rsc call fast and invisible without restructuring your routes.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
I know this has been asked a million times but I can't find a solid answer via google or GPT.
My dynamic routes e.g. /items/[id]/page.tsx that are pure 'use client' components always get rendered as dynamic pages,
resulting in _rsc calls on every view of the page - this kills the UX with an un-necessary [often slow call - 300-400ms], the page data is managed via client side Tanstack Query.
I am not clear if there is a way to prevent the _rsc calls or not.
I've also tried moving the component to a separate component with 'use client' to force static render, and still _rsc request every time.
Non-dynamic routes do not have _rsc calls.
The Pages router was so much easier.
Additional information
Next 16.1.4
Example
No response
All reactions