Andrew Clark 441aaf8f08 Separate route structure comparison from param comparison
Changing a page’s search params doesn’t change which page it is, but it may
change the data that page needs. The router currently mixes these concerns
by appending search params to `__PAGE__` segments. Remove that encoding so
we can compare which route is being rendered separately from the param
values used to render it.

Param values are now compared through the existing VaryPath data structure,
while route structure is compared during the existing tree traversals.
Each traversal can decide which comparisons matter for the work it’s doing.

Client-side comparisons and history restoration still need the search
params, so store them in a separate FlightRouterState slot for now. As
before, previous-page search params are stripped from normal request
headers. This is a temporary step that lets us migrate incrementally.
Eventually, FlightRouterState will be replaced by a type that represents
the route and its params more directly.

This is mostly a refactor, though it fixes an accidental inconsistency in
search-param handling compared with regular route params, avoiding some
redundant prefetch work.

Fully cached pages already track their vary params correctly. This
separation prepares us to do the same for partially dynamic segments during
navigation, so changing an unrelated param won’t require rendering their
dynamic content again.

With the route structure and the param values compared separately, a
navigation can now tell whether a segment's data has to be re-rendered at
all: `didReadChangedParam` walks the current and next vary paths in
lockstep and reads the node's `varyParams` only when a param actually
differs. A regular navigation (Default or Gesture) keeps a page or layout
whose output read none of the changed params — under a new node keyed at
the new vary path, written to the BFCache like any other — and does the
same for the head, which is keyed under its page's position and shares
data only when that position is unchanged. Refreshes still fetch, and
back/forward still restores the exact entry from the BFCache. A test
covers the head case where the metadata read searchParams but the page
did not.
2026-09-19 10:51:58 -04:00
2026-09-18 23:23:12 +00:00
2026-09-18 23:23:12 +00:00

Next.js logo

Next.js

Vercel logo NPM version License Join the community on GitHub

Getting Started

Used by some of the world's largest companies, Next.js enables you to create full-stack web applications by extending the latest React features, and integrating powerful Rust-based JavaScript tooling for the fastest builds.

Documentation

Visit https://nextjs.org/docs to view the full documentation.

Community

The Next.js community can be found on GitHub Discussions where you can ask questions, voice ideas, and share your projects with other people.

To chat with other community members, you can join the Next.js Discord server.

Do note that our Code of Conduct applies to all Next.js community channels. Users are highly encouraged to read and adhere to it to avoid repercussions.

Contributing

Contributions to Next.js are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to make sure you have a smooth experience contributing to Next.js.

Good First Issues:

We have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place for newcomers and beginners alike to get started, gain experience, and get familiar with our contribution process.


Security

If you believe you have found a security vulnerability in Next.js, we encourage you to responsibly disclose this and NOT open a public issue.

To participate in our Open Source Software Bug Bounty program, please email responsible.disclosure@vercel.com. We will add you to the program and provide further instructions for submitting your report.

S
Description
next-dev-loop: Verify Next.js runtime behavior after editing app code. Use this skill to confirm a change actually works in a running app — not just that it compiles or…; next-cache-components-adoption: Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache…; next-cache-components-optimizer: Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on init…
Readme 3.5 GiB
Languages
JavaScript 54.1%
TypeScript 30.9%
Rust 13.5%
MDX 0.7%
CSS 0.7%