Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions packages/react-devtools-shared/src/backend/fiber/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import {
MEMO_NUMBER,
MEMO_SYMBOL_STRING,
SERVER_CONTEXT_SYMBOL_STRING,
LAZY_SYMBOL_STRING,
} from '../shared/ReactSymbols';
import {enableStyleXFeatures} from 'react-devtools-feature-flags';

Expand Down Expand Up @@ -3045,6 +3046,25 @@ export function attach(
return null;
}

function trackDebugInfoFromLazyType(fiber: Fiber): void {
// The debugInfo from a Lazy isn't propagated onto _debugInfo of the parent Fiber the way
// it is when used in child position. So we need to pick it up explicitly.
const type = fiber.elementType;
const typeSymbol = getTypeSymbol(type); // The elementType might be have been a LazyComponent.
if (typeSymbol === LAZY_SYMBOL_STRING) {
const debugInfo: ?ReactDebugInfo = type._debugInfo;
if (debugInfo) {
for (let i = 0; i < debugInfo.length; i++) {
const debugEntry = debugInfo[i];
if (debugEntry.awaited) {
const asyncInfo: ReactAsyncInfo = (debugEntry: any);
insertSuspendedBy(asyncInfo);
}
}
}
}
}

function mountVirtualChildrenRecursively(
firstChild: Fiber,
lastChild: null | Fiber, // non-inclusive
Expand Down Expand Up @@ -3262,6 +3282,8 @@ export function attach(
// because we don't want to highlight every host node inside of a newly mounted subtree.
}

trackDebugInfoFromLazyType(fiber);

if (fiber.tag === HostHoistable) {
const nearestInstance = reconcilingParent;
if (nearestInstance === null) {
Expand Down Expand Up @@ -4040,6 +4062,8 @@ export function attach(
}
}
try {
trackDebugInfoFromLazyType(nextFiber);

if (
nextFiber.tag === HostHoistable &&
prevFiber.memoizedState !== nextFiber.memoizedState
Expand Down