{{ message }}
[PPF] Fix missing runtime-follow up if hints are stale - #98278
Draft
lubieowoce wants to merge 1 commit into
Draft
Conversation
Contributor
lubieowoce
force-pushed
the
lubieowoce/fix-runtime-followup
branch
from
September 4, 2026 22:03
6779b37 to
f31bfbe
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

if a page didn't use runtime data during build but started doing so after the revalidation (i.e. the hints say its statically-prefetchable but now it's not), we're supposed to be doing a follow-up runtime request based on the
needsRuntimeRequestpromise, but this was not actually happening.the bug goes as follows:
needsRuntimeRequestis true, we save it asPPR(orStaticShellif it's a shell rewound from the static response). otherwise, we'd have saved it asPPRRuntime(orRuntimeShellfor shells) to indicate that it satisfies those requests.wouldRuntimeRequestProvideMorecompares the runtime strategy for the current static walk to the entry's strategy to check if it should do a runtime request. this boils down to a comparison ofRuntimeShell > PPRfor a shell requestFetchStrategyenum,RuntimeShell = 3andPPR = 3, soRuntimeShell > PPRis false, which makeswouldRuntimeRequestProvideMorereturnfalse. so, if we have aPPRentry, we'll never do a follow-up runtime shell request.this is fixed by swapping the two values in the enum.
this is a bit of a lie, because there is no single correct ordering -- a
PPRentry might actually provide more content than aShellRuntimeentry if the route uses static params.however, if we end up with
PPRbut itsneedsRuntimeRequestwas true due to runtime data, that indicates that we should've done a runtime request in the first place, we just didn't know we should do so because the prefetch hint was stale, so the new ordering achieves the correct behavior in this case.Edge cases
there is one (somewhat involved) edge case to this that i know of.
if the post-revalidation static response has:
needsRuntimeRequest = falsein the shell stage)needsRuntimeRequest = truein the static stage)then we'll:
ShellRuntime(becauseneedsRuntimeRequest = false, and a runtime shell would not in fact provide more data)PPR(and notPPRRuntime, becauseneedsRuntimeRequest = true, and a runtime prefetch would provide more data)with the new ordering, this means we'll end up preferring the
ShellRuntimeentry over thePPRentry even though the shell is a strict subset of it and would be missing static params and content gated behindprefetch()ornavigation().this can be observed as follows:
<Link prefetch={true}>to such a page is revealed, we won't request a runtime shell (due to already having aShellRuntimeentry), but we will request a runtime prefetch (becausePPRis not enough). so far this is correctShellRuntimeshell entry over than thePPRentry it originated from because of the enum ordering. so we may end up not showing content despite having it in the cachei'm not sure how to resolve this yet, but i think the current
recordedFetchStrategytrick can't handle this, and we need a more involved mechanism that can detect when thePPRentry is actually better. i don't consider this a blocker for this fix thoughStack created with GitHub Stacks CLI • Give Feedback 💬