next.js
10a11fe6 - Centralize transition lifecycle in a settle chokepoint at the action queue

Commit
22 days ago
Centralize transition lifecycle in a settle chokepoint at the action queue Replace the per-reducer bookkeeping calls (attachRouterTransitionTarget in navigateToKnownRoute/restore-reducer, retargetRouterTransition in refresh-reducer/server-patch-reducer) with settleRouterTransition, called once from handleResult with (payload, prevState, nextState). Every action type is classified by what it does to the router's current destination — setting it (navigate/restore: attach the produced tree, or untrack on failure/MPA, inferred from state identity and pushRef.mpaNavigation), preserving it (refresh/server-patch/HMR: the transition follows the derived tree, so React batching can't starve its commit), or neither (server actions: follow same-URL revalidations only; redirects are a documented gap until they get first-class transitions). The satisfies-never default makes a new action type fail to compile until it declares its semantics, instead of silently starving or misattributing commits. This removes the instrumentationTransition threading through six segment-cache navigation signatures, extends the batching protection to HMR refreshes and same-URL server-action revalidations, and rewrites the unit tests to drive the lifecycle through the settle API.
Author
Committer
Parents
Loading