Skip to content

Commit a39fd4e

Browse files
committed
[Flight] Refactor the Render Loop to Behave More Like Fizz (#28065)
This refactors the Flight render loop to behave more like Fizz with similar naming conventions. So it's easier to apply similar techniques across both. This is not necessarily better/faster - at least not yet. This doesn't yet implement serialization by writing segments to chunks but we probably should do that since the built-in parts that `JSON.stringify` gets us isn't really much anymore (except serializing strings). When we switch to that it probably makes sense for the whole thing to be recursive. Right now it's not technically fully recursive because each recursive render returns the next JSON value to encode. So it's kind of like a trampoline. This means we can't have many contextual things on the stack. It needs to use the Server Context `__POP` trick. However, it does work for things that are contextual only for one sequence of server component abstractions in a row. Since those are now recursive. An interesting observation here is that `renderModel` means that anything can suspend while still serializing the outer siblings. Typically only Lazy or Components would suspend but in principle a Proxy can suspend/postpone too and now that is left serialized by reference to a future value. It's only if the thing that we rendered was something that can reduce to Lazy e.g. an Element that we can serialize it as a lazy. Similarly to how Suspense boundaries in Fizz can catch errors, anything that can be reduced to Lazy can also catch an error rather than bubbling it. It only errors when the Lazy resolves. Unlike Suspense boundaries though, those things don't render anything so they're otherwise going to use the destructive form. To ensure that throwing in an Element can reuse the current task, this must be handled by `renderModel`, not for example `renderElement`. DiffTrain build for commit b123b9c.
1 parent f158e17 commit a39fd4e

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25572,7 +25572,7 @@ if (__DEV__) {
2557225572
return root;
2557325573
}
2557425574

25575-
var ReactVersion = "18.3.0-canary-8bb6ee1d3-20240125";
25575+
var ReactVersion = "18.3.0-canary-b123b9c4f-20240125";
2557625576

2557725577
// Might add PROFILE later.
2557825578

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9131,7 +9131,7 @@ var devToolsConfig$jscomp$inline_1031 = {
91319131
throw Error("TestRenderer does not support findFiberByHostInstance()");
91329132
},
91339133
bundleType: 0,
9134-
version: "18.3.0-canary-8bb6ee1d3-20240125",
9134+
version: "18.3.0-canary-b123b9c4f-20240125",
91359135
rendererPackageName: "react-test-renderer"
91369136
};
91379137
var internals$jscomp$inline_1207 = {
@@ -9162,7 +9162,7 @@ var internals$jscomp$inline_1207 = {
91629162
scheduleRoot: null,
91639163
setRefreshHandler: null,
91649164
getCurrentFiber: null,
9165-
reconcilerVersion: "18.3.0-canary-8bb6ee1d3-20240125"
9165+
reconcilerVersion: "18.3.0-canary-b123b9c4f-20240125"
91669166
};
91679167
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
91689168
var hook$jscomp$inline_1208 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9559,7 +9559,7 @@ var devToolsConfig$jscomp$inline_1073 = {
95599559
throw Error("TestRenderer does not support findFiberByHostInstance()");
95609560
},
95619561
bundleType: 0,
9562-
version: "18.3.0-canary-8bb6ee1d3-20240125",
9562+
version: "18.3.0-canary-b123b9c4f-20240125",
95639563
rendererPackageName: "react-test-renderer"
95649564
};
95659565
var internals$jscomp$inline_1248 = {
@@ -9590,7 +9590,7 @@ var internals$jscomp$inline_1248 = {
95909590
scheduleRoot: null,
95919591
setRefreshHandler: null,
95929592
getCurrentFiber: null,
9593-
reconcilerVersion: "18.3.0-canary-8bb6ee1d3-20240125"
9593+
reconcilerVersion: "18.3.0-canary-b123b9c4f-20240125"
95949594
};
95959595
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95969596
var hook$jscomp$inline_1249 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (__DEV__) {
2424
) {
2525
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2626
}
27-
var ReactVersion = "18.3.0-canary-8bb6ee1d3-20240125";
27+
var ReactVersion = "18.3.0-canary-b123b9c4f-20240125";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,4 +539,4 @@ exports.useSyncExternalStore = function (
539539
exports.useTransition = function () {
540540
return ReactCurrentDispatcher.current.useTransition();
541541
};
542-
exports.version = "18.3.0-canary-8bb6ee1d3-20240125";
542+
exports.version = "18.3.0-canary-b123b9c4f-20240125";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ exports.useSyncExternalStore = function (
535535
exports.useTransition = function () {
536536
return ReactCurrentDispatcher.current.useTransition();
537537
};
538-
exports.version = "18.3.0-canary-8bb6ee1d3-20240125";
538+
exports.version = "18.3.0-canary-b123b9c4f-20240125";
539539
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
540540
"function" ===
541541
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8bb6ee1d33ca6c7e34342bc4b17aac0449ab6899
1+
b123b9c4f054a7def7ed84e350ccd46cc86672a6

0 commit comments

Comments
 (0)