All articles
Web DevelopmentNovember 30, 2026 6 min read

Why Our React Server Component Payloads Doubled After a 'Harmless' Refactor

A quiet refactor pushed our RSC payload from 180KB to 410KB on a single route. Here's how we found it, why it happened, and the serialization rules we now enforce in CI.

A product manager asked why a dashboard route felt sluggish on mid-tier Android. LCP was still green in the lab, but field data on INP had quietly drifted. The culprit wasn't JavaScript — it was the React Server Component payload, and a refactor nobody flagged as risky had roughly doubled it.

This is the walkthrough: what we measured, why it happened, and the rules we now enforce so it doesn't happen again.

The symptom: slow hydration on a 'fast' page

The route in question is a reporting dashboard built on the Next.js App Router. It's mostly server-rendered: a few charts, a filter panel, a table. Client components are scoped tightly — the table rows are server-rendered, the filter widget is a client island, and the chart uses a dynamic import.

Lighthouse was happy. TTFB was healthy behind our CDN. But the Chrome DevTools performance trace showed a long task right after the HTML arrived: the browser was spending 300 – 500ms parsing the RSC payload embedded in the document before hydration could proceed.

We pulled the raw payload. The __next_f chunks on this route had grown from around 180KB uncompressed to about 410KB. Gzipped the delta was smaller, but the parse and deserialization cost on low-end hardware is proportional to the uncompressed size, not the wire size. That was the INP regression.

How to actually measure RSC payload size

There's no built-in panel for this, so we wrote a small script. In a Playwright run against a local production build:

import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage();

await page.goto('http://localhost:3000/dashboard', {
  waitUntil: 'domcontentloaded',
});

const payloadBytes = await page.evaluate(() => {
  const scripts = Array.from(
    document.querySelectorAll('script')
  ) as HTMLScriptElement[];
  return scripts
    .filter((s) => s.textContent?.includes('self.__next_f'))
    .reduce((sum, s) => sum + (s.textContent?.length ?? 0), 0);
});

console.log(`RSC payload: ${(payloadBytes / 1024).toFixed(1)} KB`);
await browser.close();

We run this against every PR branch and the main branch, then diff. Anything over a 15% increase on a tracked route fails the check and requires a human sign-off.

The refactor that did the damage

The change itself looked innocuous. A shared fetchReportData function used to return a trimmed shape:

type ReportRow = {
  id: string;
  label: string;
  value: number;
  deltaPct: number;
};

Someone refactored it to return the full upstream record because two other routes needed more fields and nobody wanted three versions of the function. Reasonable instinct, bad outcome. The upstream record looked more like:

type RawReportRow = {
  id: string;
  label: string;
  value: number;
  deltaPct: number;
  meta: {
    source: string;
    tags: string[];
    history: Array<{ ts: string; v: number }>;
    annotations: Array<{ author: string; body: string; createdAt: string }>;
  };
  permissions: { read: string[]; write: string[] };
  _debug: Record<string, unknown>;
};

The dashboard's server component only rendered label, value, and deltaPct. But because the full object was passed down through the component tree and eventually reached a client component boundary — a <RowActions row={row} /> island — React serialized the entire row into the RSC payload. All 200 rows. Every nested field. Including a history array with 90 daily points each.

That's where the 230KB came from.

Why this isn't obvious from the code

In a purely server-rendered tree, passing a bloated object is free — it never leaves the server. The moment you pass a prop across a client boundary, React has to serialize it so the client can reconcile. There's no visible import, no 'use client' on the parent, no TypeScript error. The cost is invisible until you measure the payload.

The mental model that works for us: every prop crossing into a client component is a network payload. Treat it like an API response you're designing, not like a function argument.

The fix, and why it was more than a one-liner

The immediate fix was to project the shape at the boundary:

import { RowActions } from './row-actions';

type Props = { rows: RawReportRow[] };

export function ReportTable({ rows }: Props) {
  return (
    <table>
      <tbody>
        {rows.map((row) => (
          <tr key={row.id}>
            <td>{row.label}</td>
            <td>{row.value}</td>
            <td>{row.deltaPct}</td>
            <td>
              <RowActions
                rowId={row.id}
                canWrite={row.permissions.write.length > 0}
              />
            </td>
          </tr>
        ))}
      </tbody>
    </table>
  );
}

RowActions now receives two primitives instead of the whole row. Payload dropped back to around 190KB.

But the real fix was structural. We established three rules.

Rule 1: Client components get narrow, explicit prop types

No row: ReportRow. No data: ApiResponse. Client component props are flat, primitive-heavy, and named for what they render. If a client component needs five fields, it takes five props. If it needs fifteen, that's a design smell — split the component or move the boundary.

Rule 2: Projection happens at the boundary, not at the source

We stopped trying to make fetchReportData return 'just the right shape' for every caller. Fetchers return the full domain object. Server components near the client boundary project down. This keeps data access reusable and makes the serialization cost visible at the point where it's incurred.

Rule 3: Mark serialization-sensitive props in review

For any PR that adds or changes a 'use client' component, the author has to list the props and their worst-case size. It takes two minutes. It has caught three regressions since we introduced it.

Other sources of RSC bloat worth knowing

The prop-drilling case was ours, but we've seen a few others in client work.

Large Server Component children passed to client components. When a client component takes children and you pass a big server-rendered subtree, that subtree gets serialized as part of the RSC payload. This is usually fine — it's the whole point of the pattern — but if the subtree includes unnecessary wrapper components or renders thousands of items eagerly, the payload grows fast. Virtualize long lists, even server-rendered ones.

Dates and other non-primitive values. React can serialize Date, Map, Set, BigInt, and typed arrays as of React 19, which is lovely for ergonomics but easy to abuse. A Map of 10,000 entries passed as a prop is 10,000 entries in the payload.

Accidental inclusion of error objects or request metadata. We once saw a team spread ...ctx into a prop where ctx included the full incoming headers. Don't do that.

Server Actions returning large objects. The return value of a server action is serialized back to the client. If an action returns the entire updated entity when the client only needs { ok: true }, you're paying for it on every call.

What we track in CI now

Three signals, on every PR, for every tracked route:

  1. RSC payload size (uncompressed and gzipped) with a budget per route.
  2. Client JS bundle size per route, which Next.js already surfaces in the build output.
  3. Number of client component boundaries per route, as a rough proxy for serialization surface area.

None of these are hard failures on their own — they're thresholds that require a comment on the PR explaining the change. That friction is the point. It forces the conversation before the regression ships.

If you want more context on how we approach performance work end-to-end on Next.js builds, our web development services page outlines the stack we usually recommend.

Where we'd start

If you suspect RSC payload bloat on your own App Router app:

  • Open a production build in Chrome, view source, and search for self.__next_f. Eyeball the size. If any single route's embedded payload is over 250KB uncompressed, investigate.
  • Walk every 'use client' boundary on that route and list the props. For each prop, ask: what's the worst-case serialized size, and does the client component actually read every field?
  • Project shapes at the boundary. Keep fetchers general; keep client component contracts narrow.
  • Add a payload-size check to CI before you fix anything, so the fix is measurable and the regression doesn't come back in six weeks when someone 'just adds one more field'.

RSC payloads are a new kind of bundle. Treat them with the same discipline you already apply to client JavaScript, and they stay small.

#Next.js#React 19#Performance#App Router#RSC

Want a team like ours?

72Technologies builds production software for the kind of teams who actually read this blog.

Start a project