Skip to content

backport(v14): omit searchParam data from FlightRouterState before transport (#80734)#84138

Merged
ztanner merged 2 commits into14-2-1from
ztanner/backport-80734
Sep 23, 2025
Merged

backport(v14): omit searchParam data from FlightRouterState before transport (#80734)#84138
ztanner merged 2 commits into14-2-1from
ztanner/backport-80734

Conversation

@ztanner
Copy link
Copy Markdown
Member

@ztanner ztanner commented Sep 23, 2025

Certain types of data gets stashed in the client-side
`FlightRouterState`, such as the "refresh" marker alongside a URL that
the client can callback to when it needs to revalidate segments that
were "activated" on previously visited URLs. Additionally, query
parameter data gets encoded in the `__PAGE__` segment key, but isn't
actually needed by the server: `__PAGE__` segments would always be the
leaf, so it wouldn't cause any unexpected behavior in the diffing logic.

With large query params, this can lead to large amount of data needing
to be sent to the server, only for it to not actually be used. There's a
larger refactor around the server/client transport being handled in the
`experimental.clientSegmentCache` flag, so this is a stop-gap until that
behavior is stabilized.

Closes NEXT-4521
@ijjk ijjk added created-by: Next.js team PRs by the Next.js team. type: next labels Sep 23, 2025
@ztanner ztanner requested a review from ijjk September 23, 2025 12:57
@ijjk
Copy link
Copy Markdown
Member

ijjk commented Sep 23, 2025

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
buildDuration 17.6s 15.8s N/A
buildDurationCached 8.5s 7.4s N/A
nodeModulesSize 201 MB 201 MB ⚠️ +18 kB
nextStartRea..uration (ms) 402ms 403ms N/A
Client Bundles (main, webpack) Overall increase ⚠️
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
1a9f679d-HASH.js gzip 53.7 kB 53.7 kB
5428.HASH.js gzip 181 B 180 B N/A
6067-HASH.js gzip 5.14 kB 5.14 kB
6428-HASH.js gzip 31.6 kB 31.7 kB ⚠️ +133 B
framework-HASH.js gzip 44.9 kB 44.9 kB
main-app-HASH.js gzip 242 B 242 B
main-HASH.js gzip 34.2 kB 34.2 kB N/A
webpack-HASH.js gzip 1.68 kB 1.68 kB N/A
Overall change 136 kB 136 kB ⚠️ +133 B
Legacy Client Bundles (polyfills)
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Overall change 39.4 kB 39.4 kB
Client Pages
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
_app-HASH.js gzip 196 B 196 B
_error-HASH.js gzip 184 B 185 B N/A
amp-HASH.js gzip 502 B 504 B N/A
css-HASH.js gzip 321 B 324 B N/A
dynamic-HASH.js gzip 1.82 kB 1.82 kB N/A
edge-ssr-HASH.js gzip 258 B 257 B N/A
head-HASH.js gzip 352 B 352 B
hooks-HASH.js gzip 371 B 372 B N/A
image-HASH.js gzip 4.32 kB 4.32 kB N/A
index-HASH.js gzip 259 B 257 B N/A
link-HASH.js gzip 2.67 kB 2.68 kB N/A
routerDirect..HASH.js gzip 316 B 314 B N/A
script-HASH.js gzip 385 B 386 B N/A
withRouter-HASH.js gzip 311 B 310 B N/A
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 654 B 654 B
Client Build Manifests
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
_buildManifest.js gzip 484 B 481 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
index.html gzip 528 B 526 B N/A
link.html gzip 542 B 538 B N/A
withRouter.html gzip 524 B 523 B N/A
Overall change 0 B 0 B
Edge SSR bundle Size
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
edge-ssr.js gzip 95.7 kB 95.7 kB N/A
page.js gzip 3.06 kB 3.07 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
middleware-b..fest.js gzip 659 B 656 B N/A
middleware-r..fest.js gzip 156 B 154 B N/A
middleware.js gzip 25.6 kB 25.6 kB N/A
edge-runtime..pack.js gzip 839 B 839 B
Overall change 839 B 839 B
Next Runtimes
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
app-page-exp...dev.js gzip 172 kB 172 kB
app-page-exp..prod.js gzip 98.4 kB 98.4 kB
app-page-tur..prod.js gzip 100 kB 100 kB
app-page-tur..prod.js gzip 94.4 kB 94.4 kB
app-page.run...dev.js gzip 146 kB 146 kB
app-page.run..prod.js gzip 92.9 kB 92.9 kB
app-route-ex...dev.js gzip 22.6 kB 22.6 kB
app-route-ex..prod.js gzip 16 kB 16 kB
app-route-tu..prod.js gzip 16 kB 16 kB
app-route-tu..prod.js gzip 15.7 kB 15.7 kB
app-route.ru...dev.js gzip 22.2 kB 22.2 kB
app-route.ru..prod.js gzip 15.7 kB 15.7 kB
pages-api-tu..prod.js gzip 9.58 kB 9.58 kB
pages-api.ru...dev.js gzip 9.85 kB 9.85 kB
pages-api.ru..prod.js gzip 9.57 kB 9.57 kB
pages-turbo...prod.js gzip 22.5 kB 22.5 kB
pages.runtim...dev.js gzip 23.2 kB 23.2 kB
pages.runtim..prod.js gzip 22.5 kB 22.5 kB
server.runti..prod.js gzip 51.8 kB 51.8 kB
Overall change 961 kB 961 kB
build cache Overall increase ⚠️
vercel/next.js 14-2-1 vercel/next.js ztanner/backport-80734 Change
0.pack gzip 1.65 MB 1.65 MB ⚠️ +7.09 kB
index.pack gzip 114 kB 115 kB ⚠️ +1.56 kB
Overall change 1.76 MB 1.77 MB ⚠️ +8.65 kB
Diff details
Diff for middleware.js

Diff too large to display

Diff for edge-ssr.js

Diff too large to display

Diff for 6428-HASH.js

Diff too large to display

Commit: f21f4a2

@ijjk
Copy link
Copy Markdown
Member

ijjk commented Sep 23, 2025

Failing test suites

Commit: f21f4a2 | About building and testing Next.js

pnpm test-start test/e2e/prerender-native-module.test.ts

  • prerender native module > should render index correctly (DD)
  • prerender native module > should render /blog/first correctly (DD)
  • prerender native module > should render /blog/second correctly (DD)
  • prerender native module > should output traces (DD)
Expand output

● prerender native module › should render index correctly

next build failed with code/signal 1

  90 |           if (code || signal)
  91 |             reject(
> 92 |               new Error(`next build failed with code/signal ${code || signal}`)
     |               ^
  93 |             )
  94 |           else resolve()
  95 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:92:15)

● prerender native module › should render /blog/first correctly

next build failed with code/signal 1

  90 |           if (code || signal)
  91 |             reject(
> 92 |               new Error(`next build failed with code/signal ${code || signal}`)
     |               ^
  93 |             )
  94 |           else resolve()
  95 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:92:15)

● prerender native module › should render /blog/second correctly

next build failed with code/signal 1

  90 |           if (code || signal)
  91 |             reject(
> 92 |               new Error(`next build failed with code/signal ${code || signal}`)
     |               ^
  93 |             )
  94 |           else resolve()
  95 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:92:15)

● prerender native module › should output traces

next build failed with code/signal 1

  90 |           if (code || signal)
  91 |             reject(
> 92 |               new Error(`next build failed with code/signal ${code || signal}`)
     |               ^
  93 |             )
  94 |           else resolve()
  95 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:92:15)

● Test suite failed to run

TypeError: Cannot read properties of undefined (reading 'destroy')

  23 |     })
  24 |   })
> 25 |   afterAll(() => next.destroy())
     |                       ^
  26 |
  27 |   it('should render index correctly', async () => {
  28 |     const browser = await webdriver(next.url, '/')

  at Object.destroy (e2e/prerender-native-module.test.ts:25:23)

pnpm test-start test/e2e/app-dir/turbopack-reports/turbopack-reports.test.ts

  • turbopack-reports > should render page importing sqlite3 (DD)
Expand output

● turbopack-reports › should render page importing sqlite3

next build failed with code/signal 1

  90 |           if (code || signal)
  91 |             reject(
> 92 |               new Error(`next build failed with code/signal ${code || signal}`)
     |               ^
  93 |             )
  94 |           else resolve()
  95 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:92:15)

pnpm test-start test/production/build-spinners/index.test.ts

  • build-spinners > should handle build spinners correctly app dir - basic (DD)
  • build-spinners > should handle build spinners correctly app dir - (compile workers) (DD)
  • build-spinners > should handle build spinners correctly page dir (DD)
  • build-spinners > should handle build spinners correctly page dir (compile workers) (DD)
  • build-spinners > should handle build spinners correctly app and pages (DD)
Expand output

● build-spinners › should handle build spinners correctly app dir - basic

Cannot find module '../build/Release/pty.node' from '../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js'

Require stack:
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/index.js
  production/build-spinners/index.test.ts

  111 |     const nextBin = resolveFrom(appDir, 'next/dist/bin/next')
  112 |     const ptyPath = resolveFrom(appDir, 'node-pty')
> 113 |     const pty = require(ptyPath)
      |                 ^
  114 |     const output = []
  115 |     const ptyProcess = pty.spawn(process.execPath, [nextBin, 'build'], {
  116 |       name: 'xterm-color',

  at Resolver._throwModNotFoundError (../node_modules/.pnpm/jest-resolve@29.7.0/node_modules/jest-resolve/build/resolver.js:427:11)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/unixTerminal.ts:14:9)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/index.ts:14:18)
  at require (production/build-spinners/index.test.ts:113:17)

● build-spinners › should handle build spinners correctly app dir - (compile workers)

Cannot find module '../build/Release/pty.node' from '../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js'

Require stack:
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/index.js
  production/build-spinners/index.test.ts

  111 |     const nextBin = resolveFrom(appDir, 'next/dist/bin/next')
  112 |     const ptyPath = resolveFrom(appDir, 'node-pty')
> 113 |     const pty = require(ptyPath)
      |                 ^
  114 |     const output = []
  115 |     const ptyProcess = pty.spawn(process.execPath, [nextBin, 'build'], {
  116 |       name: 'xterm-color',

  at Resolver._throwModNotFoundError (../node_modules/.pnpm/jest-resolve@29.7.0/node_modules/jest-resolve/build/resolver.js:427:11)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/unixTerminal.ts:14:9)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/index.ts:14:18)
  at require (production/build-spinners/index.test.ts:113:17)

● build-spinners › should handle build spinners correctly page dir

Cannot find module '../build/Release/pty.node' from '../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js'

Require stack:
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/index.js
  production/build-spinners/index.test.ts

  111 |     const nextBin = resolveFrom(appDir, 'next/dist/bin/next')
  112 |     const ptyPath = resolveFrom(appDir, 'node-pty')
> 113 |     const pty = require(ptyPath)
      |                 ^
  114 |     const output = []
  115 |     const ptyProcess = pty.spawn(process.execPath, [nextBin, 'build'], {
  116 |       name: 'xterm-color',

  at Resolver._throwModNotFoundError (../node_modules/.pnpm/jest-resolve@29.7.0/node_modules/jest-resolve/build/resolver.js:427:11)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/unixTerminal.ts:14:9)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/index.ts:14:18)
  at require (production/build-spinners/index.test.ts:113:17)

● build-spinners › should handle build spinners correctly page dir (compile workers)

Cannot find module '../build/Release/pty.node' from '../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js'

Require stack:
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/index.js
  production/build-spinners/index.test.ts

  111 |     const nextBin = resolveFrom(appDir, 'next/dist/bin/next')
  112 |     const ptyPath = resolveFrom(appDir, 'node-pty')
> 113 |     const pty = require(ptyPath)
      |                 ^
  114 |     const output = []
  115 |     const ptyProcess = pty.spawn(process.execPath, [nextBin, 'build'], {
  116 |       name: 'xterm-color',

  at Resolver._throwModNotFoundError (../node_modules/.pnpm/jest-resolve@29.7.0/node_modules/jest-resolve/build/resolver.js:427:11)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/unixTerminal.ts:14:9)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/index.ts:14:18)
  at require (production/build-spinners/index.test.ts:113:17)

● build-spinners › should handle build spinners correctly app and pages

Cannot find module '../build/Release/pty.node' from '../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js'

Require stack:
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/unixTerminal.js
  /tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/lib/index.js
  production/build-spinners/index.test.ts

  111 |     const nextBin = resolveFrom(appDir, 'next/dist/bin/next')
  112 |     const ptyPath = resolveFrom(appDir, 'node-pty')
> 113 |     const pty = require(ptyPath)
      |                 ^
  114 |     const output = []
  115 |     const ptyProcess = pty.spawn(process.execPath, [nextBin, 'build'], {
  116 |       name: 'xterm-color',

  at Resolver._throwModNotFoundError (../node_modules/.pnpm/jest-resolve@29.7.0/node_modules/jest-resolve/build/resolver.js:427:11)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/unixTerminal.ts:14:9)
  at Object.<anonymous> (../../../../../../tmp/next-install-73f42f61462d94694668ee7436dd6edf1df57fa3f93402d6b9c746b3b26e2ca2/node_modules/.pnpm/node-pty@0.10.1/node_modules/node-pty/src/index.ts:14:18)
  at require (production/build-spinners/index.test.ts:113:17)

@ztanner ztanner merged commit cb88824 into 14-2-1 Sep 23, 2025
85 of 101 checks passed
@ztanner ztanner deleted the ztanner/backport-80734 branch September 23, 2025 16:53
@github-actions github-actions Bot added the locked label Oct 8, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants