Skip to content

Commit b94afbf

Browse files
committed
Resolve the .default export of a React.lazy as the canonical value (#34906)
For debug purposes this is the value that the `React.lazy` resolves to. It also lets us look at that value for descriptions like its name. DiffTrain build for [ec7d9a7](ec7d9a7)
1 parent 3c9fb3e commit b94afbf

34 files changed

+152
-110
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c35f6a3041816613e704772ca9dafb26568d9f89
1+
ec7d9a7249e84e841fbe1e4c22e1be2c0c15dae4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c35f6a3041816613e704772ca9dafb26568d9f89
1+
ec7d9a7249e84e841fbe1e4c22e1be2c0c15dae4

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

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -536,23 +536,40 @@ __DEV__ &&
536536
}
537537
function lazyInitializer(payload) {
538538
if (-1 === payload._status) {
539+
var resolveDebugValue = null,
540+
rejectDebugValue = null;
539541
if (enableAsyncDebugInfo) {
540542
var ioInfo = payload._ioInfo;
541-
null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
543+
null != ioInfo &&
544+
((ioInfo.start = ioInfo.end = performance.now()),
545+
(ioInfo.value = new Promise(function (resolve, reject) {
546+
resolveDebugValue = resolve;
547+
rejectDebugValue = reject;
548+
})));
542549
}
543550
ioInfo = payload._result;
544551
var thenable = ioInfo();
545552
thenable.then(
546553
function (moduleObject) {
547-
if (0 === payload._status || -1 === payload._status) {
548-
payload._status = 1;
549-
payload._result = moduleObject;
550-
var _ioInfo = payload._ioInfo;
551-
null != _ioInfo && (_ioInfo.end = performance.now());
552-
void 0 === thenable.status &&
553-
((thenable.status = "fulfilled"),
554-
(thenable.value = moduleObject));
555-
}
554+
if (0 === payload._status || -1 === payload._status)
555+
if (
556+
((payload._status = 1),
557+
(payload._result = moduleObject),
558+
enableAsyncDebugInfo)
559+
) {
560+
var _ioInfo = payload._ioInfo;
561+
if (null != _ioInfo) {
562+
_ioInfo.end = performance.now();
563+
var debugValue =
564+
null == moduleObject ? void 0 : moduleObject.default;
565+
resolveDebugValue(debugValue);
566+
_ioInfo.value.status = "fulfilled";
567+
_ioInfo.value.value = debugValue;
568+
}
569+
void 0 === thenable.status &&
570+
((thenable.status = "fulfilled"),
571+
(thenable.value = moduleObject));
572+
}
556573
},
557574
function (error) {
558575
if (0 === payload._status || -1 === payload._status)
@@ -562,7 +579,12 @@ __DEV__ &&
562579
enableAsyncDebugInfo)
563580
) {
564581
var _ioInfo2 = payload._ioInfo;
565-
null != _ioInfo2 && (_ioInfo2.end = performance.now());
582+
null != _ioInfo2 &&
583+
((_ioInfo2.end = performance.now()),
584+
_ioInfo2.value.then(noop, noop),
585+
rejectDebugValue(error),
586+
(_ioInfo2.value.status = "rejected"),
587+
(_ioInfo2.value.reason = error));
566588
void 0 === thenable.status &&
567589
((thenable.status = "rejected"), (thenable.reason = error));
568590
}
@@ -572,7 +594,6 @@ __DEV__ &&
572594
enableAsyncDebugInfo &&
573595
((ioInfo = payload._ioInfo), null != ioInfo)
574596
) {
575-
ioInfo.value = thenable;
576597
var displayName = thenable.displayName;
577598
"string" === typeof displayName && (ioInfo.name = displayName);
578599
}
@@ -1478,7 +1499,7 @@ __DEV__ &&
14781499
exports.useTransition = function () {
14791500
return resolveDispatcher().useTransition();
14801501
};
1481-
exports.version = "19.3.0-www-classic-c35f6a30-20251017";
1502+
exports.version = "19.3.0-www-classic-ec7d9a72-20251019";
14821503
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14831504
"function" ===
14841505
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -536,23 +536,40 @@ __DEV__ &&
536536
}
537537
function lazyInitializer(payload) {
538538
if (-1 === payload._status) {
539+
var resolveDebugValue = null,
540+
rejectDebugValue = null;
539541
if (enableAsyncDebugInfo) {
540542
var ioInfo = payload._ioInfo;
541-
null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
543+
null != ioInfo &&
544+
((ioInfo.start = ioInfo.end = performance.now()),
545+
(ioInfo.value = new Promise(function (resolve, reject) {
546+
resolveDebugValue = resolve;
547+
rejectDebugValue = reject;
548+
})));
542549
}
543550
ioInfo = payload._result;
544551
var thenable = ioInfo();
545552
thenable.then(
546553
function (moduleObject) {
547-
if (0 === payload._status || -1 === payload._status) {
548-
payload._status = 1;
549-
payload._result = moduleObject;
550-
var _ioInfo = payload._ioInfo;
551-
null != _ioInfo && (_ioInfo.end = performance.now());
552-
void 0 === thenable.status &&
553-
((thenable.status = "fulfilled"),
554-
(thenable.value = moduleObject));
555-
}
554+
if (0 === payload._status || -1 === payload._status)
555+
if (
556+
((payload._status = 1),
557+
(payload._result = moduleObject),
558+
enableAsyncDebugInfo)
559+
) {
560+
var _ioInfo = payload._ioInfo;
561+
if (null != _ioInfo) {
562+
_ioInfo.end = performance.now();
563+
var debugValue =
564+
null == moduleObject ? void 0 : moduleObject.default;
565+
resolveDebugValue(debugValue);
566+
_ioInfo.value.status = "fulfilled";
567+
_ioInfo.value.value = debugValue;
568+
}
569+
void 0 === thenable.status &&
570+
((thenable.status = "fulfilled"),
571+
(thenable.value = moduleObject));
572+
}
556573
},
557574
function (error) {
558575
if (0 === payload._status || -1 === payload._status)
@@ -562,7 +579,12 @@ __DEV__ &&
562579
enableAsyncDebugInfo)
563580
) {
564581
var _ioInfo2 = payload._ioInfo;
565-
null != _ioInfo2 && (_ioInfo2.end = performance.now());
582+
null != _ioInfo2 &&
583+
((_ioInfo2.end = performance.now()),
584+
_ioInfo2.value.then(noop, noop),
585+
rejectDebugValue(error),
586+
(_ioInfo2.value.status = "rejected"),
587+
(_ioInfo2.value.reason = error));
566588
void 0 === thenable.status &&
567589
((thenable.status = "rejected"), (thenable.reason = error));
568590
}
@@ -572,7 +594,6 @@ __DEV__ &&
572594
enableAsyncDebugInfo &&
573595
((ioInfo = payload._ioInfo), null != ioInfo)
574596
) {
575-
ioInfo.value = thenable;
576597
var displayName = thenable.displayName;
577598
"string" === typeof displayName && (ioInfo.name = displayName);
578599
}
@@ -1478,7 +1499,7 @@ __DEV__ &&
14781499
exports.useTransition = function () {
14791500
return resolveDispatcher().useTransition();
14801501
};
1481-
exports.version = "19.3.0-www-modern-c35f6a30-20251017";
1502+
exports.version = "19.3.0-www-modern-ec7d9a72-20251019";
14821503
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14831504
"function" ===
14841505
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
@@ -606,4 +606,4 @@ exports.useSyncExternalStore = function (
606606
exports.useTransition = function () {
607607
return ReactSharedInternals.H.useTransition();
608608
};
609-
exports.version = "19.3.0-www-classic-c35f6a30-20251017";
609+
exports.version = "19.3.0-www-classic-ec7d9a72-20251019";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,4 +606,4 @@ exports.useSyncExternalStore = function (
606606
exports.useTransition = function () {
607607
return ReactSharedInternals.H.useTransition();
608608
};
609-
exports.version = "19.3.0-www-modern-c35f6a30-20251017";
609+
exports.version = "19.3.0-www-modern-ec7d9a72-20251019";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.3.0-www-classic-c35f6a30-20251017";
613+
exports.version = "19.3.0-www-classic-ec7d9a72-20251019";
614614
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
615615
"function" ===
616616
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
@@ -610,7 +610,7 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.3.0-www-modern-c35f6a30-20251017";
613+
exports.version = "19.3.0-www-modern-ec7d9a72-20251019";
614614
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
615615
"function" ===
616616
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20371,10 +20371,10 @@ __DEV__ &&
2037120371
(function () {
2037220372
var internals = {
2037320373
bundleType: 1,
20374-
version: "19.3.0-www-classic-c35f6a30-20251017",
20374+
version: "19.3.0-www-classic-ec7d9a72-20251019",
2037520375
rendererPackageName: "react-art",
2037620376
currentDispatcherRef: ReactSharedInternals,
20377-
reconcilerVersion: "19.3.0-www-classic-c35f6a30-20251017"
20377+
reconcilerVersion: "19.3.0-www-classic-ec7d9a72-20251019"
2037820378
};
2037920379
internals.overrideHookState = overrideHookState;
2038020380
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -20409,7 +20409,7 @@ __DEV__ &&
2040920409
exports.Shape = Shape;
2041020410
exports.Surface = Surface;
2041120411
exports.Text = Text;
20412-
exports.version = "19.3.0-www-classic-c35f6a30-20251017";
20412+
exports.version = "19.3.0-www-classic-ec7d9a72-20251019";
2041320413
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2041420414
"function" ===
2041520415
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20142,10 +20142,10 @@ __DEV__ &&
2014220142
(function () {
2014320143
var internals = {
2014420144
bundleType: 1,
20145-
version: "19.3.0-www-modern-c35f6a30-20251017",
20145+
version: "19.3.0-www-modern-ec7d9a72-20251019",
2014620146
rendererPackageName: "react-art",
2014720147
currentDispatcherRef: ReactSharedInternals,
20148-
reconcilerVersion: "19.3.0-www-modern-c35f6a30-20251017"
20148+
reconcilerVersion: "19.3.0-www-modern-ec7d9a72-20251019"
2014920149
};
2015020150
internals.overrideHookState = overrideHookState;
2015120151
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -20180,7 +20180,7 @@ __DEV__ &&
2018020180
exports.Shape = Shape;
2018120181
exports.Surface = Surface;
2018220182
exports.Text = Text;
20183-
exports.version = "19.3.0-www-modern-c35f6a30-20251017";
20183+
exports.version = "19.3.0-www-modern-ec7d9a72-20251019";
2018420184
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2018520185
"function" ===
2018620186
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)