Skip to content

Commit ac5a55d

Browse files
committed
[Debug Tools] Introspect Promises in use() (#28297)
Alternative to #28295. Instead of stashing all of the Usables eagerly, we can extract them by replaying the render when we need them like we do with any other hook. We already had an implementation of `use()` but it wasn't quite complete. These can also include further DebugInfo on them such as what Server Component rendered the Promise or async debug info. This is nice just to see which use() calls were made in the side-panel but it can also be used to gather everything that might have suspended. Together with #28286 we cover the case when a Promise was used a child and if it was unwrapped with use(). Notably we don't cover a Promise that was thrown (although we do support that in a Server Component which maybe we shouldn't). Throwing a Promise isn't officially supported though and that use case should move to the use() Hook. The pattern of conditionally suspending based on cache also isn't really supported with the use() pattern. You should always call use() if you previously called use() with the same input. This also ensures that we can track what might have suspended rather than what actually did. One limitation of this strategy is that it's hard to find all the places something might suspend in a tree without rerendering all the fibers again. So we might need to still add something to the tree to indicate which Fibers may have further debug info / thenables. DiffTrain build for commit 7a32d71.
1 parent db59a3e commit ac5a55d

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
@@ -25917,7 +25917,7 @@ if (__DEV__) {
2591725917
return root;
2591825918
}
2591925919

25920-
var ReactVersion = "18.3.0-canary-3f93ca1c8-20240212";
25920+
var ReactVersion = "18.3.0-canary-7a32d718b-20240212";
2592125921

2592225922
// Might add PROFILE later.
2592325923

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
@@ -9167,7 +9167,7 @@ var devToolsConfig$jscomp$inline_1025 = {
91679167
throw Error("TestRenderer does not support findFiberByHostInstance()");
91689168
},
91699169
bundleType: 0,
9170-
version: "18.3.0-canary-3f93ca1c8-20240212",
9170+
version: "18.3.0-canary-7a32d718b-20240212",
91719171
rendererPackageName: "react-test-renderer"
91729172
};
91739173
var internals$jscomp$inline_1206 = {
@@ -9198,7 +9198,7 @@ var internals$jscomp$inline_1206 = {
91989198
scheduleRoot: null,
91999199
setRefreshHandler: null,
92009200
getCurrentFiber: null,
9201-
reconcilerVersion: "18.3.0-canary-3f93ca1c8-20240212"
9201+
reconcilerVersion: "18.3.0-canary-7a32d718b-20240212"
92029202
};
92039203
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
92049204
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
@@ -9595,7 +9595,7 @@ var devToolsConfig$jscomp$inline_1067 = {
95959595
throw Error("TestRenderer does not support findFiberByHostInstance()");
95969596
},
95979597
bundleType: 0,
9598-
version: "18.3.0-canary-3f93ca1c8-20240212",
9598+
version: "18.3.0-canary-7a32d718b-20240212",
95999599
rendererPackageName: "react-test-renderer"
96009600
};
96019601
var internals$jscomp$inline_1247 = {
@@ -9626,7 +9626,7 @@ var internals$jscomp$inline_1247 = {
96269626
scheduleRoot: null,
96279627
setRefreshHandler: null,
96289628
getCurrentFiber: null,
9629-
reconcilerVersion: "18.3.0-canary-3f93ca1c8-20240212"
9629+
reconcilerVersion: "18.3.0-canary-7a32d718b-20240212"
96309630
};
96319631
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
96329632
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
@@ -24,7 +24,7 @@ if (__DEV__) {
2424
) {
2525
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2626
}
27-
var ReactVersion = "18.3.0-canary-3f93ca1c8-20240212";
27+
var ReactVersion = "18.3.0-canary-7a32d718b-20240212";
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
@@ -590,4 +590,4 @@ exports.useSyncExternalStore = function (
590590
exports.useTransition = function () {
591591
return ReactCurrentDispatcher.current.useTransition();
592592
};
593-
exports.version = "18.3.0-canary-3f93ca1c8-20240212";
593+
exports.version = "18.3.0-canary-7a32d718b-20240212";

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
@@ -586,7 +586,7 @@ exports.useSyncExternalStore = function (
586586
exports.useTransition = function () {
587587
return ReactCurrentDispatcher.current.useTransition();
588588
};
589-
exports.version = "18.3.0-canary-3f93ca1c8-20240212";
589+
exports.version = "18.3.0-canary-7a32d718b-20240212";
590590
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
591591
"function" ===
592592
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3f93ca1c8dec1fd85df4dbb748a2df9438fc699f
1+
7a32d718b9ea0eb9ea86e9d21d56a5af6c4ce9ed

0 commit comments

Comments
 (0)