@@ -1408,7 +1408,11 @@ function finishedTask(
1408
1408
// This must have been the last segment we were waiting on. This boundary is now complete.
1409
1409
if ( segment . parentFlushed ) {
1410
1410
// Our parent segment already flushed, so we need to schedule this segment to be emitted.
1411
- boundary . completedSegments . push ( segment ) ;
1411
+ // If it is a segment that was aborted, we'll write other content instead so we don't need
1412
+ // to emit it.
1413
+ if ( segment . status === COMPLETED ) {
1414
+ boundary . completedSegments . push ( segment ) ;
1415
+ }
1412
1416
}
1413
1417
if ( boundary . parentFlushed ) {
1414
1418
// The segment might be part of a segment that didn't flush yet, but if the boundary's
@@ -1423,14 +1427,18 @@ function finishedTask(
1423
1427
} else {
1424
1428
if ( segment . parentFlushed ) {
1425
1429
// Our parent already flushed, so we need to schedule this segment to be emitted.
1426
- const completedSegments = boundary . completedSegments ;
1427
- completedSegments . push ( segment ) ;
1428
- if ( completedSegments . length === 1 ) {
1429
- // This is the first time since we last flushed that we completed anything.
1430
- // We can schedule this boundary to emit its partially completed segments early
1431
- // in case the parent has already been flushed.
1432
- if ( boundary . parentFlushed ) {
1433
- request . partialBoundaries . push ( boundary ) ;
1430
+ // If it is a segment that was aborted, we'll write other content instead so we don't need
1431
+ // to emit it.
1432
+ if ( segment . status === COMPLETED ) {
1433
+ const completedSegments = boundary . completedSegments ;
1434
+ completedSegments . push ( segment ) ;
1435
+ if ( completedSegments . length === 1 ) {
1436
+ // This is the first time since we last flushed that we completed anything.
1437
+ // We can schedule this boundary to emit its partially completed segments early
1438
+ // in case the parent has already been flushed.
1439
+ if ( boundary . parentFlushed ) {
1440
+ request . partialBoundaries . push ( boundary ) ;
1441
+ }
1434
1442
}
1435
1443
}
1436
1444
}
@@ -1570,7 +1578,7 @@ function flushSubtree(
1570
1578
default : {
1571
1579
invariant (
1572
1580
false ,
1573
- 'Errored or already flushed boundaries should not be flushed again. This is a bug in React.' ,
1581
+ 'Aborted, errored or already flushed boundaries should not be flushed again. This is a bug in React.' ,
1574
1582
) ;
1575
1583
}
1576
1584
}
0 commit comments