Skip to content

Commit 74e3721

Browse files
committed
Transfer debug info from initialized lazy node to element
1 parent 81aab70 commit 74e3721

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

packages/react-client/src/ReactFlightClient.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,15 +1185,31 @@ function initializeElement(
11851185
initializeFakeStack(response, owner);
11861186
}
11871187

1188-
// In case the JSX runtime has validated the lazy type as a static child, we
1189-
// need to transfer this information to the element.
1190-
if (
1191-
lazyNode &&
1192-
lazyNode._store &&
1193-
lazyNode._store.validated &&
1194-
!element._store.validated
1195-
) {
1196-
element._store.validated = lazyNode._store.validated;
1188+
if (lazyNode) {
1189+
// In case the JSX runtime has validated the lazy type as a static child, we
1190+
// need to transfer this information to the element.
1191+
if (
1192+
lazyNode._store &&
1193+
lazyNode._store.validated &&
1194+
!element._store.validated
1195+
) {
1196+
element._store.validated = lazyNode._store.validated;
1197+
}
1198+
1199+
if (lazyNode._payload.status === INITIALIZED) {
1200+
const debugInfo = lazyNode._debugInfo.splice(0);
1201+
if (element._debugInfo) {
1202+
// $FlowFixMe[method-unbinding]
1203+
element._debugInfo.push.apply(element._debugInfo, debugInfo);
1204+
} else {
1205+
Object.defineProperty(element, '_debugInfo', {
1206+
configurable: false,
1207+
enumerable: false,
1208+
writable: true,
1209+
value: debugInfo,
1210+
});
1211+
}
1212+
}
11971213
}
11981214

11991215
// TODO: We should be freezing the element but currently, we might write into

0 commit comments

Comments
 (0)