next.js
af9a3928 - Add shell offset to static segment prefetches (#95963)

Commit
103 days ago
Add shell offset to static segment prefetches (#95963) Updates the per-segment, static prefetch response type to include a bytes offset for the App Shell. This will allow the client to extract a shell response from a more complete response, like we already do for page-level prerender responses. All of the significant changes are confined to the server, during the step when a full page prerender is used to create per-segment responses (collect-segment-data). The overall strategy is the same one used at the page level. The input data is unblocked in distinct stages, separated by macrotasks. At each stage, we record the number of bytes that have been emitted to the output stream. Then, before closing the final stream, we embed the byte offsets into the response. During this phase, no actual user code runs: all we're doing is decoding and reencoding an existing Flight response. So the timing logic is more straightforward. For example, we don't need to worry about dynamic data leaking into the result. This commit is purely an in-place refactor. Subsequent steps will update the client to take advantage of the new offsets.
Author
Parents
Loading