Skip to content

Commit 4b439b0

Browse files
committed
[Fiber] Stash ThenableState on the Dependencies Object for Use By DevTools (#30866)
This lets us track what a Component might suspend on from DevTools. We could already collect this by replaying a component's Hooks but that would be expensive to collect from a whole tree. The thenables themselves might contain useful information but mainly we'd want access to the `_debugInfo` on the thenables which might contain additional information from the server. https://github.com/facebook/react/blob/19bd26beb689e554fceb0b929dc5199be8cba594/packages/shared/ReactTypes.js#L114 In a follow up we should really do something similar in Flight to transfer `use()` on the debugInfo of that Server Component. DiffTrain build for [8d68da3](8d68da3)
1 parent fa5cb16 commit 4b439b0

34 files changed

Lines changed: 296 additions & 124 deletions

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
96aca5f4f3d7fbe0c13350f90031d8ec4c060ccb
1+
8d68da3f7396064614f34b84881fe8833b6039ac
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
96aca5f4f3d7fbe0c13350f90031d8ec4c060ccb
1+
8d68da3f7396064614f34b84881fe8833b6039ac

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2001,7 +2001,7 @@ __DEV__ &&
20012001
exports.useTransition = function () {
20022002
return resolveDispatcher().useTransition();
20032003
};
2004-
exports.version = "19.0.0-www-classic-96aca5f4-20240827";
2004+
exports.version = "19.0.0-www-classic-8d68da3f-20240903";
20052005
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
20062006
"function" ===
20072007
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,7 @@ __DEV__ &&
19811981
exports.useTransition = function () {
19821982
return resolveDispatcher().useTransition();
19831983
};
1984-
exports.version = "19.0.0-www-modern-96aca5f4-20240827";
1984+
exports.version = "19.0.0-www-modern-8d68da3f-20240903";
19851985
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19861986
"function" ===
19871987
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
665665
exports.useTransition = function () {
666666
return ReactSharedInternals.H.useTransition();
667667
};
668-
exports.version = "19.0.0-www-classic-96aca5f4-20240827";
668+
exports.version = "19.0.0-www-classic-8d68da3f-20240903";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
665665
exports.useTransition = function () {
666666
return ReactSharedInternals.H.useTransition();
667667
};
668-
exports.version = "19.0.0-www-modern-96aca5f4-20240827";
668+
exports.version = "19.0.0-www-modern-8d68da3f-20240903";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
669669
exports.useTransition = function () {
670670
return ReactSharedInternals.H.useTransition();
671671
};
672-
exports.version = "19.0.0-www-classic-96aca5f4-20240827";
672+
exports.version = "19.0.0-www-classic-8d68da3f-20240903";
673673
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
674674
"function" ===
675675
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
669669
exports.useTransition = function () {
670670
return ReactSharedInternals.H.useTransition();
671671
};
672-
exports.version = "19.0.0-www-modern-96aca5f4-20240827";
672+
exports.version = "19.0.0-www-modern-8d68da3f-20240903";
673673
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
674674
"function" ===
675675
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3989,6 +3989,14 @@ __DEV__ &&
39893989
}
39903990
function finishRenderingHooks(current, workInProgress) {
39913991
workInProgress._debugHookTypes = hookTypesDev;
3992+
null === workInProgress.dependencies
3993+
? null !== thenableState &&
3994+
(workInProgress.dependencies = {
3995+
lanes: 0,
3996+
firstContext: null,
3997+
_debugThenableState: thenableState
3998+
})
3999+
: (workInProgress.dependencies._debugThenableState = thenableState);
39924000
ReactSharedInternals.H = ContextOnlyDispatcher;
39934001
var didRenderTooFewHooks =
39944002
null !== currentHook && null !== currentHook.next;
@@ -4168,7 +4176,11 @@ __DEV__ &&
41684176
"Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."
41694177
);
41704178
lastContextDependency = context;
4171-
JSCompiler_temp.dependencies = { lanes: 0, firstContext: context };
4179+
JSCompiler_temp.dependencies = {
4180+
lanes: 0,
4181+
firstContext: context,
4182+
_debugThenableState: null
4183+
};
41724184
JSCompiler_temp.flags |= 524288;
41734185
} else lastContextDependency = lastContextDependency.next = context;
41744186
JSCompiler_temp = value;
@@ -8708,7 +8720,11 @@ __DEV__ &&
87088720
"Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."
87098721
);
87108722
lastContextDependency = context;
8711-
consumer.dependencies = { lanes: 0, firstContext: context };
8723+
consumer.dependencies = {
8724+
lanes: 0,
8725+
firstContext: context,
8726+
_debugThenableState: null
8727+
};
87128728
consumer.flags |= 524288;
87138729
} else lastContextDependency = lastContextDependency.next = context;
87148730
return value;
@@ -14075,7 +14091,8 @@ __DEV__ &&
1407514091
? null
1407614092
: {
1407714093
lanes: pendingProps.lanes,
14078-
firstContext: pendingProps.firstContext
14094+
firstContext: pendingProps.firstContext,
14095+
_debugThenableState: pendingProps._debugThenableState
1407914096
};
1408014097
workInProgress.sibling = current.sibling;
1408114098
workInProgress.index = current.index;
@@ -14128,7 +14145,8 @@ __DEV__ &&
1412814145
? null
1412914146
: {
1413014147
lanes: renderLanes.lanes,
14131-
firstContext: renderLanes.firstContext
14148+
firstContext: renderLanes.firstContext,
14149+
_debugThenableState: renderLanes._debugThenableState
1413214150
}),
1413314151
(workInProgress.selfBaseDuration = current.selfBaseDuration),
1413414152
(workInProgress.treeBaseDuration = current.treeBaseDuration));
@@ -16789,11 +16807,11 @@ __DEV__ &&
1678916807
(function () {
1679016808
var internals = {
1679116809
bundleType: 1,
16792-
version: "19.0.0-www-classic-96aca5f4-20240827",
16810+
version: "19.0.0-www-classic-8d68da3f-20240903",
1679316811
rendererPackageName: "react-art",
1679416812
currentDispatcherRef: ReactSharedInternals,
1679516813
findFiberByHostInstance: getInstanceFromNode,
16796-
reconcilerVersion: "19.0.0-www-classic-96aca5f4-20240827"
16814+
reconcilerVersion: "19.0.0-www-classic-8d68da3f-20240903"
1679716815
};
1679816816
internals.overrideHookState = overrideHookState;
1679916817
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -16827,7 +16845,7 @@ __DEV__ &&
1682716845
exports.Shape = Shape;
1682816846
exports.Surface = Surface;
1682916847
exports.Text = Text;
16830-
exports.version = "19.0.0-www-classic-96aca5f4-20240827";
16848+
exports.version = "19.0.0-www-classic-8d68da3f-20240903";
1683116849
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1683216850
"function" ===
1683316851
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3866,6 +3866,14 @@ __DEV__ &&
38663866
}
38673867
function finishRenderingHooks(current, workInProgress) {
38683868
workInProgress._debugHookTypes = hookTypesDev;
3869+
null === workInProgress.dependencies
3870+
? null !== thenableState &&
3871+
(workInProgress.dependencies = {
3872+
lanes: 0,
3873+
firstContext: null,
3874+
_debugThenableState: thenableState
3875+
})
3876+
: (workInProgress.dependencies._debugThenableState = thenableState);
38693877
ReactSharedInternals.H = ContextOnlyDispatcher;
38703878
var didRenderTooFewHooks =
38713879
null !== currentHook && null !== currentHook.next;
@@ -4044,7 +4052,11 @@ __DEV__ &&
40444052
"Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."
40454053
);
40464054
lastContextDependency = context;
4047-
JSCompiler_temp.dependencies = { lanes: 0, firstContext: context };
4055+
JSCompiler_temp.dependencies = {
4056+
lanes: 0,
4057+
firstContext: context,
4058+
_debugThenableState: null
4059+
};
40484060
JSCompiler_temp.flags |= 524288;
40494061
} else lastContextDependency = lastContextDependency.next = context;
40504062
JSCompiler_temp = value;
@@ -8363,7 +8375,11 @@ __DEV__ &&
83638375
"Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."
83648376
);
83658377
lastContextDependency = context;
8366-
consumer.dependencies = { lanes: 0, firstContext: context };
8378+
consumer.dependencies = {
8379+
lanes: 0,
8380+
firstContext: context,
8381+
_debugThenableState: null
8382+
};
83678383
consumer.flags |= 524288;
83688384
} else lastContextDependency = lastContextDependency.next = context;
83698385
return value;
@@ -13540,7 +13556,8 @@ __DEV__ &&
1354013556
? null
1354113557
: {
1354213558
lanes: pendingProps.lanes,
13543-
firstContext: pendingProps.firstContext
13559+
firstContext: pendingProps.firstContext,
13560+
_debugThenableState: pendingProps._debugThenableState
1354413561
};
1354513562
workInProgress.sibling = current.sibling;
1354613563
workInProgress.index = current.index;
@@ -13593,7 +13610,8 @@ __DEV__ &&
1359313610
? null
1359413611
: {
1359513612
lanes: renderLanes.lanes,
13596-
firstContext: renderLanes.firstContext
13613+
firstContext: renderLanes.firstContext,
13614+
_debugThenableState: renderLanes._debugThenableState
1359713615
}),
1359813616
(workInProgress.selfBaseDuration = current.selfBaseDuration),
1359913617
(workInProgress.treeBaseDuration = current.treeBaseDuration));
@@ -16202,11 +16220,11 @@ __DEV__ &&
1620216220
(function () {
1620316221
var internals = {
1620416222
bundleType: 1,
16205-
version: "19.0.0-www-modern-96aca5f4-20240827",
16223+
version: "19.0.0-www-modern-8d68da3f-20240903",
1620616224
rendererPackageName: "react-art",
1620716225
currentDispatcherRef: ReactSharedInternals,
1620816226
findFiberByHostInstance: getInstanceFromNode,
16209-
reconcilerVersion: "19.0.0-www-modern-96aca5f4-20240827"
16227+
reconcilerVersion: "19.0.0-www-modern-8d68da3f-20240903"
1621016228
};
1621116229
internals.overrideHookState = overrideHookState;
1621216230
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -16240,7 +16258,7 @@ __DEV__ &&
1624016258
exports.Shape = Shape;
1624116259
exports.Surface = Surface;
1624216260
exports.Text = Text;
16243-
exports.version = "19.0.0-www-modern-96aca5f4-20240827";
16261+
exports.version = "19.0.0-www-modern-8d68da3f-20240903";
1624416262
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1624516263
"function" ===
1624616264
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)