[Fizz] Include componentStack at the root when aborting (#31011)
When aborting we currently don't produce a componentStack when aborting the shell. This is likely just an oversight and this change updates this behavior to be consistent with what we do when there is a boundary
Josh Story committed
Sep 20, 2024 at 10:00 UTC
ae75d5a3f5cf14a5031ee251376b1adf88c32813
1 file changed
+2
-2
packages/react-server/src/ReactFizzServer.js
+2
-2
@@ -3870,8 +3870,9 @@ function abortTask(task: Task, request: Request, error: mixed): void {
3870
segment.status = ABORTED;
3871
}
3872
3873
+ const errorInfo = getThrownInfo(task.componentStack);
3874
+
3875
if (boundary === null) {
3874
- const errorInfo: ThrownInfo = {};
3876
if (request.status !== CLOSING && request.status !== CLOSED) {
3877
const replay: null | ReplaySet = task.replay;
3878
if (replay === null) {
@@ -3957,7 +3958,6 @@ function abortTask(task: Task, request: Request, error: mixed): void {
3958
boundary.pendingTasks--;
3959
// We construct an errorInfo from the boundary's componentStack so the error in dev will indicate which
3960
// boundary the message is referring to
3960
- const errorInfo = getThrownInfo(task.componentStack);
3961
const trackedPostpones = request.trackedPostpones;
3962
if (boundary.status !== CLIENT_RENDERED) {
3963
if (enableHalt) {