Skip to content

Commit 3d92b7b

Browse files
committed
[Flight] Emit Partial Debug Info if we have any at the point of aborting a render (#33632)
When we abort a render we don't really have much information about the task that was aborted. Because before a Promise resolves there's no indication about would have resolved it. In particular we don't know which I/O would've ultimately called resolve(). However, we can at least emit any information we do have at the point where we emit it. At the least the stack of the top most Promise. Currently we synchronously flush at the end of an `abort()` but we should ideally schedule the flush in a macrotask and emit this debug information right before that. That way we would give an opportunity for any `cacheSignal()` abort to trigger rejections all the way up and those rejections informs the awaited stack. --------- Co-authored-by: Hendrik Liebau <[email protected]> DiffTrain build for [e67b4fe](e67b4fe)
1 parent 57e4b48 commit 3d92b7b

36 files changed

+1320
-1069
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
94cf60bede7cd6685e07a4374d1e3aa90445130b
1+
e67b4fe22e0c3c267303ee6737aec1db48055022
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
94cf60bede7cd6685e07a4374d1e3aa90445130b
1+
e67b4fe22e0c3c267303ee6737aec1db48055022

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ __DEV__ &&
14791479
exports.useTransition = function () {
14801480
return resolveDispatcher().useTransition();
14811481
};
1482-
exports.version = "19.2.0-www-classic-94cf60be-20250624";
1482+
exports.version = "19.2.0-www-classic-e67b4fe2-20250624";
14831483
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14841484
"function" ===
14851485
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
@@ -1479,7 +1479,7 @@ __DEV__ &&
14791479
exports.useTransition = function () {
14801480
return resolveDispatcher().useTransition();
14811481
};
1482-
exports.version = "19.2.0-www-modern-94cf60be-20250624";
1482+
exports.version = "19.2.0-www-modern-e67b4fe2-20250624";
14831483
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14841484
"function" ===
14851485
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
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.2.0-www-classic-94cf60be-20250624";
633+
exports.version = "19.2.0-www-classic-e67b4fe2-20250624";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.2.0-www-modern-94cf60be-20250624";
633+
exports.version = "19.2.0-www-modern-e67b4fe2-20250624";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.2.0-www-classic-94cf60be-20250624";
637+
exports.version = "19.2.0-www-classic-e67b4fe2-20250624";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
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
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.2.0-www-modern-94cf60be-20250624";
637+
exports.version = "19.2.0-www-modern-e67b4fe2-20250624";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,27 @@ __DEV__ &&
15061506
"disabledDepth fell below zero. This is a bug in React. Please file an issue."
15071507
);
15081508
}
1509+
function formatOwnerStack(error) {
1510+
var prevPrepareStackTrace = Error.prepareStackTrace;
1511+
Error.prepareStackTrace = void 0;
1512+
error = error.stack;
1513+
Error.prepareStackTrace = prevPrepareStackTrace;
1514+
error.startsWith("Error: react-stack-top-frame\n") &&
1515+
(error = error.slice(29));
1516+
prevPrepareStackTrace = error.indexOf("\n");
1517+
-1 !== prevPrepareStackTrace &&
1518+
(error = error.slice(prevPrepareStackTrace + 1));
1519+
prevPrepareStackTrace = error.indexOf("react-stack-bottom-frame");
1520+
-1 !== prevPrepareStackTrace &&
1521+
(prevPrepareStackTrace = error.lastIndexOf(
1522+
"\n",
1523+
prevPrepareStackTrace
1524+
));
1525+
if (-1 !== prevPrepareStackTrace)
1526+
error = error.slice(0, prevPrepareStackTrace);
1527+
else return "";
1528+
return error;
1529+
}
15091530
function describeBuiltInComponentFrame(name) {
15101531
if (void 0 === prefix)
15111532
try {
@@ -1678,27 +1699,6 @@ __DEV__ &&
16781699
"function" === typeof fn && componentFrameCache.set(fn, sampleLines);
16791700
return sampleLines;
16801701
}
1681-
function formatOwnerStack(error) {
1682-
var prevPrepareStackTrace = Error.prepareStackTrace;
1683-
Error.prepareStackTrace = void 0;
1684-
error = error.stack;
1685-
Error.prepareStackTrace = prevPrepareStackTrace;
1686-
error.startsWith("Error: react-stack-top-frame\n") &&
1687-
(error = error.slice(29));
1688-
prevPrepareStackTrace = error.indexOf("\n");
1689-
-1 !== prevPrepareStackTrace &&
1690-
(error = error.slice(prevPrepareStackTrace + 1));
1691-
prevPrepareStackTrace = error.indexOf("react-stack-bottom-frame");
1692-
-1 !== prevPrepareStackTrace &&
1693-
(prevPrepareStackTrace = error.lastIndexOf(
1694-
"\n",
1695-
prevPrepareStackTrace
1696-
));
1697-
if (-1 !== prevPrepareStackTrace)
1698-
error = error.slice(0, prevPrepareStackTrace);
1699-
else return "";
1700-
return error;
1701-
}
17021702
function describeFiber(fiber) {
17031703
switch (fiber.tag) {
17041704
case 26:
@@ -1737,11 +1737,25 @@ __DEV__ &&
17371737
for (var i = debugInfo.length - 1; 0 <= i; i--) {
17381738
var entry = debugInfo[i];
17391739
if ("string" === typeof entry.name) {
1740-
var JSCompiler_temp_const = info,
1741-
env = entry.env;
1742-
var JSCompiler_inline_result = describeBuiltInComponentFrame(
1743-
entry.name + (env ? " [" + env + "]" : "")
1744-
);
1740+
var JSCompiler_temp_const = info;
1741+
a: {
1742+
var name = entry.name,
1743+
env = entry.env,
1744+
location = entry.debugLocation;
1745+
if (null != location) {
1746+
var childStack = formatOwnerStack(location),
1747+
idx = childStack.lastIndexOf("\n"),
1748+
lastLine =
1749+
-1 === idx ? childStack : childStack.slice(idx + 1);
1750+
if (-1 !== lastLine.indexOf(name)) {
1751+
var JSCompiler_inline_result = "\n" + lastLine;
1752+
break a;
1753+
}
1754+
}
1755+
JSCompiler_inline_result = describeBuiltInComponentFrame(
1756+
name + (env ? " [" + env + "]" : "")
1757+
);
1758+
}
17451759
info = JSCompiler_temp_const + JSCompiler_inline_result;
17461760
}
17471761
}
@@ -19059,10 +19073,10 @@ __DEV__ &&
1905919073
(function () {
1906019074
var internals = {
1906119075
bundleType: 1,
19062-
version: "19.2.0-www-classic-94cf60be-20250624",
19076+
version: "19.2.0-www-classic-e67b4fe2-20250624",
1906319077
rendererPackageName: "react-art",
1906419078
currentDispatcherRef: ReactSharedInternals,
19065-
reconcilerVersion: "19.2.0-www-classic-94cf60be-20250624"
19079+
reconcilerVersion: "19.2.0-www-classic-e67b4fe2-20250624"
1906619080
};
1906719081
internals.overrideHookState = overrideHookState;
1906819082
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19096,7 +19110,7 @@ __DEV__ &&
1909619110
exports.Shape = Shape;
1909719111
exports.Surface = Surface;
1909819112
exports.Text = Text;
19099-
exports.version = "19.2.0-www-classic-94cf60be-20250624";
19113+
exports.version = "19.2.0-www-classic-e67b4fe2-20250624";
1910019114
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1910119115
"function" ===
1910219116
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,27 @@ __DEV__ &&
14121412
"disabledDepth fell below zero. This is a bug in React. Please file an issue."
14131413
);
14141414
}
1415+
function formatOwnerStack(error) {
1416+
var prevPrepareStackTrace = Error.prepareStackTrace;
1417+
Error.prepareStackTrace = void 0;
1418+
error = error.stack;
1419+
Error.prepareStackTrace = prevPrepareStackTrace;
1420+
error.startsWith("Error: react-stack-top-frame\n") &&
1421+
(error = error.slice(29));
1422+
prevPrepareStackTrace = error.indexOf("\n");
1423+
-1 !== prevPrepareStackTrace &&
1424+
(error = error.slice(prevPrepareStackTrace + 1));
1425+
prevPrepareStackTrace = error.indexOf("react-stack-bottom-frame");
1426+
-1 !== prevPrepareStackTrace &&
1427+
(prevPrepareStackTrace = error.lastIndexOf(
1428+
"\n",
1429+
prevPrepareStackTrace
1430+
));
1431+
if (-1 !== prevPrepareStackTrace)
1432+
error = error.slice(0, prevPrepareStackTrace);
1433+
else return "";
1434+
return error;
1435+
}
14151436
function describeBuiltInComponentFrame(name) {
14161437
if (void 0 === prefix)
14171438
try {
@@ -1584,27 +1605,6 @@ __DEV__ &&
15841605
"function" === typeof fn && componentFrameCache.set(fn, sampleLines);
15851606
return sampleLines;
15861607
}
1587-
function formatOwnerStack(error) {
1588-
var prevPrepareStackTrace = Error.prepareStackTrace;
1589-
Error.prepareStackTrace = void 0;
1590-
error = error.stack;
1591-
Error.prepareStackTrace = prevPrepareStackTrace;
1592-
error.startsWith("Error: react-stack-top-frame\n") &&
1593-
(error = error.slice(29));
1594-
prevPrepareStackTrace = error.indexOf("\n");
1595-
-1 !== prevPrepareStackTrace &&
1596-
(error = error.slice(prevPrepareStackTrace + 1));
1597-
prevPrepareStackTrace = error.indexOf("react-stack-bottom-frame");
1598-
-1 !== prevPrepareStackTrace &&
1599-
(prevPrepareStackTrace = error.lastIndexOf(
1600-
"\n",
1601-
prevPrepareStackTrace
1602-
));
1603-
if (-1 !== prevPrepareStackTrace)
1604-
error = error.slice(0, prevPrepareStackTrace);
1605-
else return "";
1606-
return error;
1607-
}
16081608
function describeFiber(fiber) {
16091609
switch (fiber.tag) {
16101610
case 26:
@@ -1643,11 +1643,25 @@ __DEV__ &&
16431643
for (var i = debugInfo.length - 1; 0 <= i; i--) {
16441644
var entry = debugInfo[i];
16451645
if ("string" === typeof entry.name) {
1646-
var JSCompiler_temp_const = info,
1647-
env = entry.env;
1648-
var JSCompiler_inline_result = describeBuiltInComponentFrame(
1649-
entry.name + (env ? " [" + env + "]" : "")
1650-
);
1646+
var JSCompiler_temp_const = info;
1647+
a: {
1648+
var name = entry.name,
1649+
env = entry.env,
1650+
location = entry.debugLocation;
1651+
if (null != location) {
1652+
var childStack = formatOwnerStack(location),
1653+
idx = childStack.lastIndexOf("\n"),
1654+
lastLine =
1655+
-1 === idx ? childStack : childStack.slice(idx + 1);
1656+
if (-1 !== lastLine.indexOf(name)) {
1657+
var JSCompiler_inline_result = "\n" + lastLine;
1658+
break a;
1659+
}
1660+
}
1661+
JSCompiler_inline_result = describeBuiltInComponentFrame(
1662+
name + (env ? " [" + env + "]" : "")
1663+
);
1664+
}
16511665
info = JSCompiler_temp_const + JSCompiler_inline_result;
16521666
}
16531667
}
@@ -18831,10 +18845,10 @@ __DEV__ &&
1883118845
(function () {
1883218846
var internals = {
1883318847
bundleType: 1,
18834-
version: "19.2.0-www-modern-94cf60be-20250624",
18848+
version: "19.2.0-www-modern-e67b4fe2-20250624",
1883518849
rendererPackageName: "react-art",
1883618850
currentDispatcherRef: ReactSharedInternals,
18837-
reconcilerVersion: "19.2.0-www-modern-94cf60be-20250624"
18851+
reconcilerVersion: "19.2.0-www-modern-e67b4fe2-20250624"
1883818852
};
1883918853
internals.overrideHookState = overrideHookState;
1884018854
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -18868,7 +18882,7 @@ __DEV__ &&
1886818882
exports.Shape = Shape;
1886918883
exports.Surface = Surface;
1887018884
exports.Text = Text;
18871-
exports.version = "19.2.0-www-modern-94cf60be-20250624";
18885+
exports.version = "19.2.0-www-modern-e67b4fe2-20250624";
1887218886
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1887318887
"function" ===
1887418888
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)