[pull] canary from vercel:canary#804
Merged
pull[bot] merged 1 commit intocode:canaryfrom Feb 19, 2026
Merged
Conversation
Runtime prefetch responses previously encoded `isPartial` and `staleTime` using a sentinel-and-replace pattern: a random number was embedded in the RSC payload during prerendering, then a TransformStream scanned the prelude stream to find and replace it with the actual values. This was fragile because it relied on matching a specific byte sequence in a chunked stream that could be split at arbitrary boundaries. This replaces that mechanism with two simpler approaches: - **isPartial**: A single byte prepended to the response stream (`#` for complete, `~` for partial). - **staleTime**: An `AsyncIterable<number>` in the Flight payload that yields updated stale time values as the prerender store changes. This ensures the latest value is always serialized in the stream, even when sync IO aborts the prerender before the abort callback runs. The stale time tracking logic is extracted into a new `stale-time.ts` module with `StaleTimeIterable`, `trackStaleTime`, and `finishStaleTimeTracking`. On the client, dynamic runtime prefetch responses (detected via the absence of `NEXT_IS_PRERENDER_HEADER`) have the byte stripped before Flight decoding, and the stale time is read by iterating the async iterable. Static responses served from cache are handled unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )