8
*/
9
10
import type {
11
+ Thenable,
12
ReactComponentInfo,
13
ReactDebugInfo,
14
ReactAsyncInfo,
3182
}
3183
}
3184
3185
+ function trackDebugInfoFromUsedThenables(fiber: Fiber): void {
3186
+ // If a Fiber called use() in DEV mode then we may have collected _debugThenableState on
3187
+ // the dependencies. If so, then this will contain the thenables passed to use().
3188
+ // These won't have their debug info picked up by fiber._debugInfo since that just
3189
+ // contains things suspending the children. We have to collect use() separately.
3190
+ const dependencies = fiber.dependencies;
3191
+ if (dependencies == null) {
3192
+ return;
3193
+ }
3194
+ const thenableState = dependencies._debugThenableState;
3195
+ if (thenableState == null) {
3196
+ return;
3197
+ }
3198
+ // In DEV the thenableState is an inner object.
3199
+ const usedThenables: any = thenableState.thenables || thenableState;
3200
+ if (!Array.isArray(usedThenables)) {
3201
+ return;
3202
+ }
3203
+ for (let i = 0; i < usedThenables.length; i++) {
3204
+ const thenable: Thenable<mixed> = usedThenables[i];
3205
+ const debugInfo = thenable._debugInfo;
3206
+ if (debugInfo) {
3207
+ for (let j = 0; j < debugInfo.length; j++) {
3208
+ const debugEntry = debugInfo[i];
3209
+ if (debugEntry.awaited) {
3210
+ const asyncInfo: ReactAsyncInfo = (debugEntry: any);
3211
+ insertSuspendedBy(asyncInfo);
3212
+ }
3213
+ }
3214
+ }
3215
+ }
3216
+ }
3217
+
3218
function mountVirtualChildrenRecursively(
3219
firstChild: Fiber,
3220
lastChild: null | Fiber, // non-inclusive
3434
}
3435
3436
trackDebugInfoFromLazyType(fiber);
3437
+ trackDebugInfoFromUsedThenables(fiber);
3438
3439
if (fiber.tag === HostHoistable) {
3440
const nearestInstance = reconcilingParent;
4266
}
4267
try {
4268
trackDebugInfoFromLazyType(nextFiber);
4269
+ trackDebugInfoFromUsedThenables(nextFiber);
4270
4271
if (
4272
nextFiber.tag === HostHoistable &&