feat(rsc): ability to preserve decoded server references#1253
Open
james-elicx wants to merge 7 commits into
Open
feat(rsc): ability to preserve decoded server references#1253james-elicx wants to merge 7 commits into
james-elicx wants to merge 7 commits into
Conversation
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.
Extracts the core, React, and server-manifest reference-preservation changes from #1246.
RSC frameworks may need to cache, proxy, or compose Flight fragments before sending them back to the browser. A concrete example is a
use cachewrapper that stores a rendered product card as a Flight stream and later replays it into a new RSC response.That cached fragment can still contain a server action, like an “add to cart” action owned by the framework/runtime. During replay, the cache layer should not have to import the action implementation from the app bundler manifest; it only needs to keep the action reference opaque so the browser can call it through the normal action path later.
This adds an opt-in
serverReferences: "preserve"decode mode for that case. It also preserves and deduplicates server-reference export names when transforms share a module, and adds an experimentalserverReferenceMarkersoption so preceding transforms can mark modules whose server-reference metadata must survive the"use server"HMR cleanup pass.The e2e caches a Flight stream containing a framework-owned server action reference, replays that cached stream, and verifies the replayed client UI can still invoke the action.