next.js
c713d487 - Refactor server from CacheNodeSeedData -> TransportData (#96679)

Commit
7 days ago
Refactor server from CacheNodeSeedData -> TransportData (#96679) The previous PR in this stack introduced TransportData, the unified response format, but produced it via a temporary adapter layer that converted from the old data formats — FlightRouterState and CacheNodeSeedData trees, encoded as FlightDataPath entries. As promised there, this PR updates the server to produce the new format directly and deletes the adapter. Neither FlightRouterState nor CacheNodeSeedData appears in a rendered response anymore; FlightRouterState survives only on the client (router state, history) and as the request tree the client sends to the server, and CacheNodeSeedData is deleted from the codebase entirely. createComponentTree now returns the response's transport tree: each node carries its segment identity, its prefetch hints, and its render output, constructed in place as the tree renders. When a non-PPR prefetch stops at a loading boundary, the subtree below the cut is emitted as structure-only nodes with no render output — the same shape the client already interprets as "fetch lazily". createFlightRouterStateFromLoaderTree is replaced by createTransportTreeFromLoaderTree, which covers the cases where nothing is rendered: router-state-only responses, route tree prefetches, the structure below a loading-boundary cut, and error payloads. The prefetch hints computation is shared with createComponentTree through computeSegmentPrefetchHints so the two producers cannot drift. walkTreeWithFlightRouterState returns the transport tree those producers build: each emit is a transport node, and the levels above it become "skipped" nodes (position acknowledged, no output attached). The FlightDataPath encoding this replaces — repeating [segment, parallelRouteKey] prefixes terminated by a positional data tuple, plus the hack in generateDynamicRSCPayload that sliced the root segment off every path — is deleted, along with the FlightData, FlightDataPath, and FlightDataSegment types. This also deletes the overriddenSegment / canSegmentBeOverridden mechanism, which turned out to be dead code: it could only trigger if a dynamic segment reached the walk as an uninterpolated string, but getDynamicParam throws in that case rather than returning null. Instant validation rebuilds its payload tree natively as well: the builders walk the original payload's transport tree in parallel with the loader tree, taking structure from the former and render output from the validation segment cache.
Author
Parents
Loading