next.js
0e1b6d6a - Track vary params for segments without server-side param access (#88998)

Commit
1 day ago
Track vary params for segments without server-side param access (#88998) Based on: - https://github.com/vercel/next.js/pull/88834 - https://github.com/vercel/next.js/pull/88989 --- This implements a partial "vary params" optimization for the segment cache. When a segment doesn't access params on the server, its prefetched data can be reused across different param values. Two cases are handled: 1. Segments without a user-provided layout (only loading.tsx or nothing) 2. Segments with a 'use client' layout The server now includes a varyParams field in segment prefetch responses. When varyParams is an empty Set, the client re-keys the cache entry with Fallback for all param values, making it reusable across different params. This is a stepping stone toward full vary params tracking where Server Components would track which specific params they access during rendering.
Author
Parents
Loading