nextjs - 💡(How to fix) Fix PPR Streaming Fails with template.tsx on Vercel [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86791Fetched 2026-04-08 02:09:10
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
issue_type_added ×1labeled ×1

Root Cause

template.tsx is documented as the way to handle:

  • Page transition animations
  • State reset on navigation
  • Per-page layouts that remount

With PPR/Cache Components being the new default in Next.js 16, this incompatibility should either be:

  1. Fixed to work correctly
  2. Documented as a known limitation
  3. Emit a build warning when template.tsx + cacheComponents are used together

Code Example

// next.config.ts
   const nextConfig = {
     cacheComponents: true,
   };
   export default nextConfig;

---

app/
   └── (home)/
       ├── template.tsx
       └── page.tsx

---

// app/(home)/template.tsx
   export default function Template({
     children,
   }: {
     children: React.ReactNode;
   }) {
     return <main>{children}</main>;
   }

---

// app/(home)/page.tsx
   import { Suspense } from "react";
   import { connection } from "next/server";

   async function AsyncContent() {
     await connection();
     const data = await fetch("https://jsonplaceholder.typicode.com/posts/1", {
       cache: "no-store",
     }).then((r) => r.json());
     return <div>Title: {data.title}</div>;
   }

   export default function Page() {
     return (
       <Suspense fallback={<div>Loading...</div>}>
         <AsyncContent />
       </Suspense>
     );
   }

---

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro (10.0.26200)

Binaries:
  Node: v22.10.0
  pnpm: 10.24.0

Relevant Packages:
  next: 16.0.6
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3

Next.js Config:
  cacheComponents: true
  reactCompiler: true
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/laguagu/ppr-issue

To Reproduce

. Create a Next.js 16 app with cacheComponents: true:

// next.config.ts
const nextConfig = {
  cacheComponents: true,
};
export default nextConfig;
  1. Create a route group with template.tsx:

    app/
    └── (home)/
        ├── template.tsx
        └── page.tsx
  2. Add a simple template:

    // app/(home)/template.tsx
    export default function Template({
      children,
    }: {
      children: React.ReactNode;
    }) {
      return <main>{children}</main>;
    }
  3. Add async Server Components with Suspense in page.tsx:

    // app/(home)/page.tsx
    import { Suspense } from "react";
    import { connection } from "next/server";
    
    async function AsyncContent() {
      await connection();
      const data = await fetch("https://jsonplaceholder.typicode.com/posts/1", {
        cache: "no-store",
      }).then((r) => r.json());
      return <div>Title: {data.title}</div>;
    }
    
    export default function Page() {
      return (
        <Suspense fallback={<div>Loading...</div>}>
          <AsyncContent />
        </Suspense>
      );
    }
  4. Run locally with next build && next start - works correctly

  5. Deploy to Vercel - streaming fails

Current vs. Expected behavior

Current vs. Expected behavior

Expected:

  • Static shell renders immediately
  • Dynamic content streams in as Suspense boundaries resolve
  • Same behavior on Vercel as local production build

Actual on Vercel:

  • Static shell renders correctly (template wrapper, layout)
  • Suspense fallbacks never resolve - content remains empty
  • No errors in console, logs, or Vercel function logs
  • Build output shows (Partial Prerender) as expected

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro (10.0.26200)

Binaries:
  Node: v22.10.0
  pnpm: 10.24.0

Relevant Packages:
  next: 16.0.6
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3

Next.js Config:
  cacheComponents: true
  reactCompiler: true

Which area(s) are affected? (Select all that apply)

Partial Prerendering (PPR), cacheComponents, Use Cache, Loading UI and Streaming

Which stage(s) are affected? (Select all that apply)

Vercel (Deployed)

Additional context

  • Only reproducible on Vercel - local next build && next start works correctly
  • The issue seems to be specific to how Vercel's edge runtime handles template.tsx remounting behavior in combination with PPR streaming
  • Build output shows the route as (Partial Prerender) in both cases
  • No errors are thrown - the streaming simply doesn't occur
  • Replacing template.tsx with layout.tsx is an immediate fix

Why this matters

template.tsx is documented as the way to handle:

  • Page transition animations
  • State reset on navigation
  • Per-page layouts that remount

With PPR/Cache Components being the new default in Next.js 16, this incompatibility should either be:

  1. Fixed to work correctly
  2. Documented as a known limitation
  3. Emit a build warning when template.tsx + cacheComponents are used together

extent analysis

TL;DR

The issue can be worked around by replacing template.tsx with layout.tsx, as this resolves the incompatibility with Vercel's edge runtime and Partial Prerendering (PPR) streaming.

Guidance

  • Verify that the issue is specific to the combination of template.tsx and PPR streaming on Vercel by testing with layout.tsx instead.
  • Check the Vercel documentation for any known limitations or issues with template.tsx and PPR.
  • Consider adding a build warning when template.tsx and cacheComponents are used together, to alert developers to this potential issue.
  • Test the application with cacheComponents set to false to see if this resolves the issue, although this may not be a desirable long-term solution.

Example

No code snippet is provided as the issue is more related to configuration and deployment rather than a specific code problem.

Notes

The issue seems to be specific to how Vercel's edge runtime handles template.tsx remounting behavior in combination with PPR streaming. Replacing template.tsx with layout.tsx is an immediate fix, but this may not be the desired solution for all use cases.

Recommendation

Apply the workaround by replacing template.tsx with layout.tsx, as this is the most straightforward way to resolve the issue with Vercel's edge runtime and PPR streaming.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING