Add commit and abort events to router transition instrumentation#95328
Add commit and abort events to router transition instrumentation#95328gaojude wants to merge 1 commit into
Conversation
Failing test suitesCommit: fd1b112 | About building and testing Next.js
Expand output● instrumentation client router transition events - dead code elimination › when the experimental flag is enabled › keeps the transition event payload in the client bundle
Expand output● instrumentation client router transition events - dead code elimination › when the experimental flag is enabled › keeps the transition event payload in the client bundle
Expand output● instrumentation client router transition events - dead code elimination › when the experimental flag is enabled › keeps the transition event payload in the client bundle |
Stats cancelledCommit: fd1b112 |
Extends the experimental client router transition instrumentation (behind
experimental.instrumentationClientRouterTransitionEvents) from a start-only hook to a full lifecycle. Every transition emitsonRouterTransitionStartand then exactly one ofunstable_onRouterTransitionCommitorunstable_onRouterTransitionAbort, all sharing oneid.onRouterTransitionStartnow carries afromTreeroute descriptor (renderedPathname,canonicalUrl,routeTemplateswith positional:Nholes and@slotparallel routes, positionalparams,searchParams) in place offromRoutes, andprefetchIntentis removed.commitadds the committedtoTreeand ahit/missoutcome—misswhen the page segment had no cached content and rendered a fallback (the head is excluded since it streams non-blocking).abortfires for an in-flight transition superseded before it commits, withcauseset to the committing transition'sid.Transitions correlate by their committed
FlightRouterStateidentity via a module-level buffer that drains on each commit, so no id is threaded ontoAppRouterState.startis emitted from the dispatcher rather than the reducer, keeping user hooks out of React's render phase where a throwing hook would break error isolation. Covered by theinstrumentation-client-hooke2e suite.