Skip to content

Commit ea0950f

Browse files
committed
[Flight][Fizz] schedule work async (#29551)
While most builds of Flight and Fizz schedule work in new tasks some do execute work synchronously. While this is necessary for legacy APIs like renderToString for modern APIs there really isn't a great reason to do this synchronously. We could schedule works as microtasks but we actually want to yield so the runtime can run events and other things that will unblock additional work before starting the next work loop. This change updates all non-legacy uses to be async using the best availalble macrotask scheduler. Browser now uses postMessage Bun uses setTimeout because while it also supports setImmediate the scheduling is not as eager as the same API in node the FB build also uses setTimeout This change required a number of changes to tests which were utilizing the sync nature of work in the Browser builds to avoid having to manage timers and tasks. I added a patch to install MessageChannel which is required by the browser builds and made this patched version integrate with the Scheduler mock. This way we can effectively use `act` to flush flight and fizz work similar to how we do this on the client. DiffTrain build for commit b526a0a.
1 parent cb22111 commit ea0950f

File tree

14 files changed

+36
-36
lines changed

14 files changed

+36
-36
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.0.0-native-fb-fd6e130b00-20240606
1+
19.0.0-native-fb-b526a0a419-20240606

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<bfa319a88e7ba395f362da35c7c6ae6d>>
10+
* @generated SignedSource<<aeb5412de032acf9afc7bd5d88a329b3>>
1111
*/
1212

1313
'use strict';
@@ -23580,7 +23580,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
2358023580
return root;
2358123581
}
2358223582

23583-
var ReactVersion = '19.0.0-native-fb-fd6e130b00-20240606';
23583+
var ReactVersion = '19.0.0-native-fb-b526a0a419-20240606';
2358423584

2358523585
/*
2358623586
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<647ed1e416c3ed5bd4544633bb22aa90>>
10+
* @generated SignedSource<<071298c9ff96ae03132c2f6189a9505d>>
1111
*/
1212

1313
"use strict";
@@ -9336,7 +9336,7 @@ var devToolsConfig$jscomp$inline_1048 = {
93369336
throw Error("TestRenderer does not support findFiberByHostInstance()");
93379337
},
93389338
bundleType: 0,
9339-
version: "19.0.0-native-fb-fd6e130b00-20240606",
9339+
version: "19.0.0-native-fb-b526a0a419-20240606",
93409340
rendererPackageName: "react-test-renderer"
93419341
};
93429342
var internals$jscomp$inline_1235 = {
@@ -9367,7 +9367,7 @@ var internals$jscomp$inline_1235 = {
93679367
scheduleRoot: null,
93689368
setRefreshHandler: null,
93699369
getCurrentFiber: null,
9370-
reconcilerVersion: "19.0.0-native-fb-fd6e130b00-20240606"
9370+
reconcilerVersion: "19.0.0-native-fb-b526a0a419-20240606"
93719371
};
93729372
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
93739373
var hook$jscomp$inline_1236 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<9f25c533425fd58fff1087add02bb332>>
10+
* @generated SignedSource<<2b7f28997d14368e8b072ffc1497cb77>>
1111
*/
1212

1313
"use strict";
@@ -9958,7 +9958,7 @@ var devToolsConfig$jscomp$inline_1131 = {
99589958
throw Error("TestRenderer does not support findFiberByHostInstance()");
99599959
},
99609960
bundleType: 0,
9961-
version: "19.0.0-native-fb-fd6e130b00-20240606",
9961+
version: "19.0.0-native-fb-b526a0a419-20240606",
99629962
rendererPackageName: "react-test-renderer"
99639963
};
99649964
(function (internals) {
@@ -10002,7 +10002,7 @@ var devToolsConfig$jscomp$inline_1131 = {
1000210002
scheduleRoot: null,
1000310003
setRefreshHandler: null,
1000410004
getCurrentFiber: null,
10005-
reconcilerVersion: "19.0.0-native-fb-fd6e130b00-20240606"
10005+
reconcilerVersion: "19.0.0-native-fb-b526a0a419-20240606"
1000610006
});
1000710007
exports._Scheduler = Scheduler;
1000810008
exports.act = act;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<da04ffd0168478b278088d1dd71f702c>>
10+
* @generated SignedSource<<27df3fd4e7100982c8f4ef7d518a4510>>
1111
*/
1212

1313
'use strict';
@@ -24,7 +24,7 @@ if (
2424
}
2525
var dynamicFlagsUntyped = require('ReactNativeInternalFeatureFlags');
2626

27-
var ReactVersion = '19.0.0-native-fb-fd6e130b00-20240606';
27+
var ReactVersion = '19.0.0-native-fb-b526a0a419-20240606';
2828

2929
// Re-export dynamic flags from the internal module.
3030
var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<530a2382ebd13dd17d916c2400554edd>>
10+
* @generated SignedSource<<02284763378c01e6ceb319a485aebf4e>>
1111
*/
1212

1313
"use strict";
@@ -604,4 +604,4 @@ exports.useSyncExternalStore = function (
604604
exports.useTransition = function () {
605605
return ReactSharedInternals.H.useTransition();
606606
};
607-
exports.version = "19.0.0-native-fb-fd6e130b00-20240606";
607+
exports.version = "19.0.0-native-fb-b526a0a419-20240606";

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<a797769e754cbf0362b7fbf62774837d>>
10+
* @generated SignedSource<<27f9d9eb4116e19c56a7659cf6b57e21>>
1111
*/
1212

1313
"use strict";
@@ -608,7 +608,7 @@ exports.useSyncExternalStore = function (
608608
exports.useTransition = function () {
609609
return ReactSharedInternals.H.useTransition();
610610
};
611-
exports.version = "19.0.0-native-fb-fd6e130b00-20240606";
611+
exports.version = "19.0.0-native-fb-b526a0a419-20240606";
612612
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
613613
"function" ===
614614
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fd6e130b00d4d1fe211c75e981160131669c4412
1+
b526a0a419029eea31f4d967951b6feca123012d

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<5c37d417b9b99eae764bfce3356ed6b3>>
10+
* @generated SignedSource<<557c39946498737c4c67c5ed81c7a5e8>>
1111
*/
1212

1313
'use strict';
@@ -26316,7 +26316,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
2631626316
return root;
2631726317
}
2631826318

26319-
var ReactVersion = '19.0.0-rc-fd6e130b00-20240606';
26319+
var ReactVersion = '19.0.0-rc-b526a0a419-20240606';
2632026320

2632126321
/*
2632226322
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<d1f70b65b4e74dcab410f7c82fd04449>>
10+
* @generated SignedSource<<5d81da86232cf85d0e472d78b33810df>>
1111
*/
1212

1313
"use strict";
@@ -10591,7 +10591,7 @@ var roots = new Map(),
1059110591
devToolsConfig$jscomp$inline_1125 = {
1059210592
findFiberByHostInstance: getInstanceFromNode,
1059310593
bundleType: 0,
10594-
version: "19.0.0-rc-fd6e130b00-20240606",
10594+
version: "19.0.0-rc-b526a0a419-20240606",
1059510595
rendererPackageName: "react-native-renderer",
1059610596
rendererConfig: {
1059710597
getInspectorDataForInstance: getInspectorDataForInstance,
@@ -10634,7 +10634,7 @@ var internals$jscomp$inline_1351 = {
1063410634
scheduleRoot: null,
1063510635
setRefreshHandler: null,
1063610636
getCurrentFiber: null,
10637-
reconcilerVersion: "19.0.0-rc-fd6e130b00-20240606"
10637+
reconcilerVersion: "19.0.0-rc-b526a0a419-20240606"
1063810638
};
1063910639
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1064010640
var hook$jscomp$inline_1352 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

0 commit comments

Comments
 (0)