dillon1000/react

Commit

[Flight] Allow custom encoding of the form action (#27563)

There are three parts to an RSC set up:

- React
- Bundler
- Endpoints

Most customizability is in the bundler configs. We deal with those as
custom builds.

To create a full set up, you need to also configure ways to expose end
points for example to call a Server Action. That's typically not
something the bundler is responsible for even though it's responsible
for gathering the end points that needs generation. Exposing which
endpoints to generate is a responsibility for the bundler.

Typically a meta-framework is responsible for generating the end points.

There's two ways to "call" a Server Action. Through JS and through a
Form. Through JS we expose the `callServer` callback so that the
framework can call the end point.

Forms by default POST back to the current page with an action serialized
into form data, which we have a decoder helper for. However, this is not
something that React is really opinionated about just like we're not
opinionated about the protocol used by callServer.

This exposes an option to configure the encoding of the form props.
`encodeFormAction` is to the SSR is what `callServer` is to the Browser.
Browse files
Changed paths10 files
First-parent comparison
M packages/react-client/src/ReactFlightClient.js ModifiedM packages/react-client/src/ReactFlightReplyClient.js ModifiedM packages/react-server-dom-esm/src/ReactFlightDOMClientBrowser.js ModifiedM packages/react-server-dom-esm/src/ReactFlightDOMClientNode.js ModifiedM packages/react-server-dom-turbopack/src/ReactFlightDOMClientBrowser.js ModifiedM packages/react-server-dom-turbopack/src/ReactFlightDOMClientEdge.js ModifiedM packages/react-server-dom-turbopack/src/ReactFlightDOMClientNode.js ModifiedM packages/react-server-dom-webpack/src/ReactFlightDOMClientBrowser.js ModifiedM packages/react-server-dom-webpack/src/ReactFlightDOMClientEdge.js ModifiedM packages/react-server-dom-webpack/src/ReactFlightDOMClientNode.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…