Skip to content

Commit ce24091

Browse files
committed
[Float][Fiber] Enable Float methods to be called outside of render (#26557)
Stacked on #26570 Previously we restricted Float methods to only being callable while rendering. This allowed us to make associations between calls and their position in the DOM tree, for instance hoisting preinitialized styles into a ShadowRoot or an iframe Document. When considering how we are going to support Flight support in Float however it became clear that this restriction would lead to compromises on the implementation because the Flight client does not execute within the context of a client render. We want to be able to disaptch Float directives coming from Flight as soon as possible and this requires being able to call them outside of render. this patch modifies Float so that its methods are callable anywhere. The main consequence of this change is Float will always use the Document the renderer script is running within as the HoistableRoot. This means if you preinit as style inside a component render targeting a ShadowRoot the style will load in the ownerDocument not the ShadowRoot. Practially speaking it means that preinit is not useful inside ShadowRoots and iframes. This tradeoff was deemed acceptable because these methods are optimistic, not critical. Additionally, the other methods, preconntect, prefetchDNS, and preload, are not impacted because they already operated at the level of the ownerDocument and really only interface with the Network cache layer. I added a couple additional fixes that were necessary for getting tests to pass that are worth considering separately. The first commit improves the diff for `waitForThrow` so it compares strings if possible. The second commit makes invokeGuardedCallback not use metaprogramming pattern and swallows any novel errors produced from trying to run the guarded callback. Swallowing may not be the best we can do but it at least protects React against rapid failure when something causes the dispatchEvent to throw. DiffTrain build for commit fdad813.
1 parent 73fddfc commit ce24091

13 files changed

Lines changed: 19 additions & 19 deletions

File tree

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
@@ -23859,7 +23859,7 @@ function createFiberRoot(
2385923859
return root;
2386023860
}
2386123861

23862-
var ReactVersion = "18.3.0-next-e5708b3ea-20230420";
23862+
var ReactVersion = "18.3.0-next-fdad813ac-20230420";
2386323863

2386423864
// Might add PROFILE later.
2386523865

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
@@ -8599,7 +8599,7 @@ var devToolsConfig$jscomp$inline_1021 = {
85998599
throw Error("TestRenderer does not support findFiberByHostInstance()");
86008600
},
86018601
bundleType: 0,
8602-
version: "18.3.0-next-e5708b3ea-20230420",
8602+
version: "18.3.0-next-fdad813ac-20230420",
86038603
rendererPackageName: "react-test-renderer"
86048604
};
86058605
var internals$jscomp$inline_1206 = {
@@ -8630,7 +8630,7 @@ var internals$jscomp$inline_1206 = {
86308630
scheduleRoot: null,
86318631
setRefreshHandler: null,
86328632
getCurrentFiber: null,
8633-
reconcilerVersion: "18.3.0-next-e5708b3ea-20230420"
8633+
reconcilerVersion: "18.3.0-next-fdad813ac-20230420"
86348634
};
86358635
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
86368636
var hook$jscomp$inline_1207 = __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
@@ -9025,7 +9025,7 @@ var devToolsConfig$jscomp$inline_1063 = {
90259025
throw Error("TestRenderer does not support findFiberByHostInstance()");
90269026
},
90279027
bundleType: 0,
9028-
version: "18.3.0-next-e5708b3ea-20230420",
9028+
version: "18.3.0-next-fdad813ac-20230420",
90299029
rendererPackageName: "react-test-renderer"
90309030
};
90319031
var internals$jscomp$inline_1247 = {
@@ -9056,7 +9056,7 @@ var internals$jscomp$inline_1247 = {
90569056
scheduleRoot: null,
90579057
setRefreshHandler: null,
90589058
getCurrentFiber: null,
9059-
reconcilerVersion: "18.3.0-next-e5708b3ea-20230420"
9059+
reconcilerVersion: "18.3.0-next-fdad813ac-20230420"
90609060
};
90619061
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
90629062
var hook$jscomp$inline_1248 = __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
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-next-e5708b3ea-20230420";
30+
var ReactVersion = "18.3.0-next-fdad813ac-20230420";
3131

3232
// ATTENTION
3333
// 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
@@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
639639
);
640640
};
641641
exports.useTransition = useTransition;
642-
exports.version = "18.3.0-next-e5708b3ea-20230420";
642+
exports.version = "18.3.0-next-fdad813ac-20230420";

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
@@ -642,7 +642,7 @@ exports.useSyncExternalStore = function (
642642
);
643643
};
644644
exports.useTransition = useTransition;
645-
exports.version = "18.3.0-next-e5708b3ea-20230420";
645+
exports.version = "18.3.0-next-fdad813ac-20230420";
646646

647647
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
648648
if (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e5708b3ea9190c1285c9081ff338e46be9ff39bc
1+
fdad813ac765e901e2957b8d36fba87e5504e5f4

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27169,7 +27169,7 @@ function createFiberRoot(
2716927169
return root;
2717027170
}
2717127171

27172-
var ReactVersion = "18.3.0-next-e5708b3ea-20230420";
27172+
var ReactVersion = "18.3.0-next-fdad813ac-20230420";
2717327173

2717427174
function createPortal$1(
2717527175
children,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9470,7 +9470,7 @@ var roots = new Map(),
94709470
devToolsConfig$jscomp$inline_1045 = {
94719471
findFiberByHostInstance: getInstanceFromNode,
94729472
bundleType: 0,
9473-
version: "18.3.0-next-e5708b3ea-20230420",
9473+
version: "18.3.0-next-fdad813ac-20230420",
94749474
rendererPackageName: "react-native-renderer",
94759475
rendererConfig: {
94769476
getInspectorDataForViewTag: function () {
@@ -9512,7 +9512,7 @@ var internals$jscomp$inline_1276 = {
95129512
scheduleRoot: null,
95139513
setRefreshHandler: null,
95149514
getCurrentFiber: null,
9515-
reconcilerVersion: "18.3.0-next-e5708b3ea-20230420"
9515+
reconcilerVersion: "18.3.0-next-fdad813ac-20230420"
95169516
};
95179517
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95189518
var hook$jscomp$inline_1277 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10179,7 +10179,7 @@ var roots = new Map(),
1017910179
devToolsConfig$jscomp$inline_1123 = {
1018010180
findFiberByHostInstance: getInstanceFromNode,
1018110181
bundleType: 0,
10182-
version: "18.3.0-next-e5708b3ea-20230420",
10182+
version: "18.3.0-next-fdad813ac-20230420",
1018310183
rendererPackageName: "react-native-renderer",
1018410184
rendererConfig: {
1018510185
getInspectorDataForViewTag: function () {
@@ -10234,7 +10234,7 @@ var roots = new Map(),
1023410234
scheduleRoot: null,
1023510235
setRefreshHandler: null,
1023610236
getCurrentFiber: null,
10237-
reconcilerVersion: "18.3.0-next-e5708b3ea-20230420"
10237+
reconcilerVersion: "18.3.0-next-fdad813ac-20230420"
1023810238
});
1023910239
exports.createPortal = function (children, containerTag) {
1024010240
return createPortal$1(

0 commit comments

Comments
 (0)