This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
frontendcritical PriorityID: react-19-ppr-dynamic-hole-boundary-standard

React 19 PPR Deterministic Dynamic Hole Boundary Standard

Enforces strict physical boundaries between static build-time shells and deferred dynamic execution contexts under React 19 Partial Prerendering (PPR). Prevents dynamic I/O leakage into static prerender passes, eliminates client-side Cumulative Layout Shift (CLS) via mandatory skeleton geometry preservation, and prohibits nested streaming waterfalls.

Prohibited Anti-Pattern: Dynamic I/O Pollution of Static Prerender Shells Causing Build De-optimization and Cascade Waterfalls

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: React 19 PPR Deterministic Dynamic Hole Boundary Standard - Enforces strict physical boundaries between static build-time shells and deferred dynamic execution contexts under React 19 Partial Prerendering (PPR). Prevents dynamic I/O leakage into static prerender passes, eliminates client-side Cumulative Layout Shift (CLS) via mandatory skeleton geometry preservation, and prohibits nested streaming waterfalls.
globs: src/app/**/*.{ts,tsx}, app/**/*.{ts,tsx}, components/**/*.{ts,tsx}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/react-19-ppr-dynamic-hole-boundary-standard"
---

# React 19 PPR Deterministic Dynamic Hole Boundary Standard

> **Severity**: CRITICAL | **Category**: frontend
> **Anti-Pattern Warning**: Dynamic I/O Pollution of Static Prerender Shells Causing Build De-optimization and Cascade Waterfalls

## System Constraints
You are a Principal Engineer enforcing the React 19 Partial Prerendering (PPR) Dynamic Hole Boundary Standard. You must mandate that every route segment cleanly delineates static layout shells from dynamic execution contexts. Ensure that dynamic runtime APIs (cookies, headers, searchParams, uncached I/O) are isolated within explicit <Suspense> boundaries, and mandate that dynamic fallback skeletons match exact physical dimensions to guarantee zero layout shift upon streaming hydration.

## Strict Guidelines
- Components accessing dynamic APIs (e.g., `cookies()`, `headers()`, `connection()`, uncached `fetch`, or Dynamic Data Stores) MUST be wrapped within an explicit `<Suspense>` dynamic hole boundary.
- Engineers MUST NOT access dynamic context APIs (such as headers or cookies) at the root level of a static shell component or layout, as doing so de-opts the entire subtree from static prerendering.
- Dynamic hole fallbacks MUST define explicit CSS bounding dimensions (fixed/min-height, aspect-ratio, or equivalent layout containment) matching the resolved dynamic content to prevent layout shifts (CLS > 0).
- Dynamic components MUST execute data dependencies concurrently at the boundary perimeter rather than sequentially inside nested child components to prevent cascading streaming waterfalls.
- Engineers MUST leverage the `connection()` signal or standard PPR opt-in flags to assert static prerender safety and catch accidental runtime data dependencies during build-time validation.
- Components NEVER use client-side effect cascades (`useEffect` + `setState`) for initial layout composition when the data can be resolved via a server-driven deferred dynamic chunk.

## Bad vs Good Implementations
### Dynamic Context De-optimizing Static Route Shell vs Isolated Dynamic Hole

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Invoking `cookies()` at the root page scope dynamically bails the entire page segment out of the static prerender phase. The static navigation and container layout cannot be emitted as a static HTML shell, introducing unnecessary latency and defeating PPR.
```typescript
import { cookies } from 'next/headers';
import { CartSummary } from '@/components/cart-summary';
import { StaticNav } from '@/components/static-nav';

// ANTI-PATTERN: Root-level dynamic access converts entire page to runtime-rendered
export default async function Page() {
  const cookieStore = await cookies();
  const cartId = cookieStore.get('cartId')?.value;
  
  return (
    <main className="p-6">
      <StaticNav /> {/* Forced to render dynamically at runtime */}
      <div className="mt-4">
        <CartSummary cartId={cartId} />
      </div>
    </main>
  );
}
```

#### Production Standard (Correct)
> **Standard**: The page shell renders purely static HTML at build time. Dynamic cookie access is confined inside `DynamicCartWrapper` behind a `<Suspense>` boundary. The fallback skeleton explicitly preserves the 160px layout height to avoid CLS when the chunk streams.
```typescript
import { Suspense } from 'react';
import { cookies } from 'next/headers';
import { StaticNav } from '@/components/static-nav';

// PRODUCTION INVARIANT: Root remains pure static shell; dynamic I/O isolated in hole
export default function Page() {
  return (
    <main className="p-6">
      <StaticNav /> {/* Prerendered statically at build time */}
      <div className="mt-4 min-h-[160px]">
        <Suspense fallback={<CartSummarySkeleton />}>
          <DynamicCartWrapper />
        </Suspense>
      </div>
    </main>
  );
}

async function DynamicCartWrapper() {
  const cookieStore = await cookies();
  const cartId = cookieStore.get('cartId')?.value;
  return <CartSummary cartId={cartId} />;
}

function CartSummarySkeleton() {
  return <div className="h-[160px] w-full animate-pulse rounded bg-slate-100" />;
}
```

### Cascading Dynamic Waterfall Inside Suspense Hole vs Parallelized Data Boundary

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Splitting interdependent dynamic fetches across nested Suspense boundaries inside an already dynamic chunk introduces consecutive roundtrip streaming latency (waterfalls), stalling client-side settlement.
```typescript
import { Suspense } from 'react';

// ANTI-PATTERN: Nested dependent streaming waterfall inside the dynamic hole
export function UserDashboardHole() {
  return (
    <Suspense fallback={<div className="h-40" />}>
      <UserProfileContainer />
    </Suspense>
  );
}

async function UserProfileContainer() {
  const user = await fetch('/api/user').then(r => r.json());
  return (
    <div>
      <h2>{user.name}</h2>
      <Suspense fallback={<div className="h-20" />}>
        {/* Sequential waterfall: fetches only after user completes */}
        <UserOrdersSubResource userId={user.id} />
      </Suspense>
    </div>
  );
}

async function UserOrdersSubResource({ userId }: { userId: string }) {
  const orders = await fetch(`/api/orders?user=${userId}`).then(r => r.json());
  return <div>Orders: {orders.length}</div>;
}
```

#### Production Standard (Correct)
> **Standard**: All dynamic dependencies for the layout segment resolve concurrently within a unified boundary, avoiding internal streaming waterfalls and guaranteeing deterministic settlement within an invariant container frame.
```typescript
import { Suspense } from 'react';

interface DashboardData {
  user: { id: string; name: string };
  orders: Array<{ id: string }>;
}

// PRODUCTION INVARIANT: Concurrent boundary resolution via unified promise dispatch
export function UserDashboardHole() {
  return (
    <Suspense fallback={<div className="h-[240px] w-full animate-pulse bg-slate-100" />}>
      <DashboardStream />
    </Suspense>
  );
}

async function DashboardStream() {
  // Trigger fetches in parallel or resolve single composite server query
  const [user, orders] = await Promise.all([
    fetch('/api/user').then(r => r.json()),
    fetch('/api/orders/current').then(r => r.json())
  ]);

  return (
    <div className="min-h-[240px]">
      <h2 className="text-lg font-bold">{user.name}</h2>
      <div>Orders: {orders.length}</div>
    </div>
  );
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: React 19 PPR Deterministic Dynamic Hole Boundary Standard

React 19 PPR Deterministic Dynamic Hole Boundary Standard defines an industrial-grade behavioral standard for frontend engineering. Enforces strict physical boundaries between static build-time shells and deferred dynamic execution contexts under React 19 Partial Prerendering (PPR). Prevents dynamic I/O leakage into static prerender passes, eliminates client-side Cumulative Layout Shift (CLS) via mandatory skeleton geometry preservation, and prohibits nested streaming waterfalls. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Dynamic I/O Pollution of Static Prerender Shells Causing Build De-optimization and Cascade Waterfalls Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftDynamic I/O Pollution of Static Prerender Shells Causing Build De-optimization and Cascade WaterfallsCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Components accessing dynamic APIs (e.g., `cookies()`, `headers()`, `connection()`, uncached `fetch`, or Dynamic Data Stores) MUST be wrapped within an explicit `<Suspense>` dynamic hole boundary.

Components accessing dynamic APIs (e.g., `cookies()`, `headers()`, `connection()`, uncached `fetch`, or Dynamic Data Stores) MUST be wrapped within an explicit `<Suspense>` dynamic hole boundary.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT access dynamic context APIs (such as headers or cookies) at the root level of a static shell component or layout, as doing so de-opts the entire subtree from static prerendering.

Engineers MUST NOT access dynamic context APIs (such as headers or cookies) at the root level of a static shell component or layout, as doing so de-opts the entire subtree from static prerendering.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Dynamic hole fallbacks MUST define explicit CSS bounding dimensions (fixed/min-height, aspect-ratio, or equivalent layout containment) matching the resolved dynamic content to prevent layout shifts (CLS > 0).

Dynamic hole fallbacks MUST define explicit CSS bounding dimensions (fixed/min-height, aspect-ratio, or equivalent layout containment) matching the resolved dynamic content to prevent layout shifts (CLS > 0).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Dynamic components MUST execute data dependencies concurrently at the boundary perimeter rather than sequentially inside nested child components to prevent cascading streaming waterfalls.

Dynamic components MUST execute data dependencies concurrently at the boundary perimeter rather than sequentially inside nested child components to prevent cascading streaming waterfalls.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Engineers MUST leverage the `connection()` signal or standard PPR opt-in flags to assert static prerender safety and catch accidental runtime data dependencies during build-time validation.

Engineers MUST leverage the `connection()` signal or standard PPR opt-in flags to assert static prerender safety and catch accidental runtime data dependencies during build-time validation.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
6

Components NEVER use client-side effect cascades (`useEffect` + `setState`) for initial layout composition when the data can be resolved via a server-driven deferred dynamic chunk.

Components NEVER use client-side effect cascades (`useEffect` + `setState`) for initial layout composition when the data can be resolved via a server-driven deferred dynamic chunk.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is React 19 PPR Deterministic Dynamic Hole Boundary Standard critical for AI coding assistants?

Enforces strict physical boundaries between static build-time shells and deferred dynamic execution contexts under React 19 Partial Prerendering (PPR). Prevents dynamic I/O leakage into static prerender passes, eliminates client-side Cumulative Layout Shift (CLS) via mandatory skeleton geometry preservation, and prohibits nested streaming waterfalls. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Dynamic I/O Pollution of Static Prerender Shells Causing Build De-optimization and Cascade Waterfalls) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

Related FRONTEND Rules

View all rules →
frontend
119

SolidStart 1.0 Server Functions & Async Boundaries Production Standard

SolidStart 1.0 relies on the Vinxi bundler to split `server$` closures into independent HTTP POST RPC endpoints. Direct lexical closure over client signals within `server$` scopes or failure to demarcate async boundaries with `<Suspense>` causes silent serialization failures, client-bundle secret leaks, and SSR hydration mismatches. Enforcing strict parameter passing, runtime input validation, and Solid async primitives maintains security and fine-grained reactivity across network boundaries.

frontend
119

Astro 5 Actions & Content Layer Production Standard

Enforces strict type safety and architectural correctness for Astro 5 Server Actions and the zero-waterfall Content Layer API. Prevents runtime contract mismatches, hydration mismatches, and unhandled mutation exceptions across dynamic and prerendered boundaries. Failure to follow these patterns leads to silent data fetching waterfalls, build-time cache corruptions, and unhandled server action exceptions.

frontend
51

Nuxt 4 Nitro Server Engine & Shared Directory Production Standard

Nuxt 4 enforces strict boundary segregation between client UI in the app/ directory, backend endpoints in server/, and universal contracts in shared/. Violating cross-boundary isolation or maintaining module-scoped state in Nitro server handlers causes catastrophic cross-request data corruption and hydration mismatches under concurrent production traffic. Architects must enforce request-isolated H3 event contexts, universal serialization schemas, and strict path-alias boundaries.

1 Rule in Stack

React