Refactor: scope requestStore to dynamic renders only (#72312)#5
Open
MitchLewis930 wants to merge 1 commit intopr_035_beforefrom
Open
Refactor: scope requestStore to dynamic renders only (#72312)#5MitchLewis930 wants to merge 1 commit intopr_035_beforefrom
MitchLewis930 wants to merge 1 commit intopr_035_beforefrom
Conversation
This completes the refactor to eliminate a requestStore scoped around prerenders. Now we only scope requestStore around dynamic renders. If you are prerendering then the workUnitAsyncStorage will only have a prerneder store or undefined. While it is possible to shadow stores because you can enter a cache scope from a render or prerender it generally should never be the case that you enter a prerender from a request or enter a request from a prerender. These are effectively top level scopes. This should not change any program behavior stacked on vercel#72212
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.
PR_035
Note
Medium Risk
Touches core App Router render/action plumbing and async storage scoping; regressions could affect request context (cookies, HMR refresh, ISR status) during dynamic renders and Server Actions.
Overview
Refactors app rendering so
requestStoreis created and scoped only for dynamic renders, instead of being built up-front for all requests. This changes therenderToHTMLOrFlightcall stack to pass args throughworkAsyncStorage.run(...)directly and creates therequestStoreinside the dynamic branch (also moving the devsetAppIsrStatusupdate there).Updates server action + Flight generation to consistently run under
workUnitAsyncStoragewith the correctrequestStore(including wrapping action execution,generateDynamicRSCPayload, andrenderToReadableStream), and threadsrequestStoreexplicitly throughgenerateFlight/finalizeAndGenerateFlight.Tweaks
createRequestStoreForRender’s parameter ordering to accommodate the new call sites (addingserverComponentsHmrCache/resume cache ordering).Written by Cursor Bugbot for commit 071a059. This will update automatically on new commits. Configure here.