Skip to content

Commit

Permalink
[Flight] Progressively Enhanced Server Actions (#26774)
Browse files Browse the repository at this point in the history
This automatically exposes `$$FORM_ACTIONS` on Server References coming
from Flight. So that when they're used in a form action, we can encode
the ID for the server reference as a hidden field or as part of the name
of a button.

If the Server Action is a bound function it can have complex data
associated with it. In this case this additional data is encoded as
additional form fields.

To process a POST on the server there's now a `decodeAction` helper that
can take one of these progressive posts from FormData and give you a
function that is prebound with the correct closure and FormData so that
you can just invoke it.

I updated the fixture which now has a "Server State" that gets
automatically refreshed. This also lets us visualize form fields.
There's no "Action State" here for showing error messages that are not
thrown, that's still up to user space.

DiffTrain build for commit aef7ce5.
  • Loading branch information
sebmarkbage committed May 3, 2023
1 parent 9c64b4c commit 2ebe873
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23918,7 +23918,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-c10010a6a-20230503";
var ReactVersion = "18.3.0-canary-aef7ce554-20230503";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8623,7 +8623,7 @@ var devToolsConfig$jscomp$inline_1039 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-c10010a6a-20230503",
version: "18.3.0-canary-aef7ce554-20230503",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1238 = {
Expand Down Expand Up @@ -8654,7 +8654,7 @@ var internals$jscomp$inline_1238 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-c10010a6a-20230503"
reconcilerVersion: "18.3.0-canary-aef7ce554-20230503"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1239 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9049,7 +9049,7 @@ var devToolsConfig$jscomp$inline_1081 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-c10010a6a-20230503",
version: "18.3.0-canary-aef7ce554-20230503",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1279 = {
Expand Down Expand Up @@ -9080,7 +9080,7 @@ var internals$jscomp$inline_1279 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-c10010a6a-20230503"
reconcilerVersion: "18.3.0-canary-aef7ce554-20230503"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1280 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-c10010a6a-20230503";
var ReactVersion = "18.3.0-canary-aef7ce554-20230503";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,4 +642,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-canary-c10010a6a-20230503";
exports.version = "18.3.0-canary-aef7ce554-20230503";
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-canary-c10010a6a-20230503";
exports.version = "18.3.0-canary-aef7ce554-20230503";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c10010a6a00911fe99452bc561dd47c3e15f4eb8
aef7ce5547c9489dc48e31f69b002cd17206e0cb

0 comments on commit 2ebe873

Please sign in to comment.