@@ -994,6 +994,8 @@ function renderSuspenseBoundary(
994
994
}
995
995
encodeErrorForBoundary ( newBoundary , errorDigest , error , thrownInfo ) ;
996
996
997
+ untrackBoundary ( request , newBoundary ) ;
998
+
997
999
// We don't need to decrement any task numbers because we didn't spawn any new task.
998
1000
// We don't need to schedule any task because we know the parent has written yet.
999
1001
// We do need to fallthrough to create the fallback though.
@@ -2672,6 +2674,33 @@ function trackPostpone(
2672
2674
}
2673
2675
}
2674
2676
2677
+ // In case a boundary errors, we need to stop tracking it because we won't
2678
+ // resume it.
2679
+ function untrackBoundary ( request : Request , boundary : SuspenseBoundary ) {
2680
+ const trackedPostpones = request . trackedPostpones ;
2681
+ if ( trackedPostpones === null ) {
2682
+ return ;
2683
+ }
2684
+ const boundaryKeyPath = boundary . trackedContentKeyPath ;
2685
+ if ( boundaryKeyPath === null ) {
2686
+ return ;
2687
+ }
2688
+ const boundaryNode : void | ReplayNode =
2689
+ trackedPostpones . workingMap . get ( boundaryKeyPath ) ;
2690
+ if ( boundaryNode === undefined ) {
2691
+ return ;
2692
+ }
2693
+
2694
+ // Downgrade to plain ReplayNode since we won't replay through it.
2695
+ boundaryNode . length = 4 ;
2696
+ // Remove any resumable slots.
2697
+ boundaryNode [ 2 ] = [ ] ;
2698
+ boundaryNode [ 3 ] = null ;
2699
+
2700
+ // TODO: We should really just remove the boundary from all parent paths too so
2701
+ // we don't replay the path to it.
2702
+ }
2703
+
2675
2704
function injectPostponedHole (
2676
2705
request : Request ,
2677
2706
task : RenderTask ,
@@ -3007,6 +3036,7 @@ function erroredTask(
3007
3036
if ( boundary . status !== CLIENT_RENDERED ) {
3008
3037
boundary . status = CLIENT_RENDERED ;
3009
3038
encodeErrorForBoundary ( boundary , errorDigest , error , errorInfo ) ;
3039
+ untrackBoundary ( request , boundary ) ;
3010
3040
3011
3041
// Regardless of what happens next, this boundary won't be displayed,
3012
3042
// so we can flush it, if the parent already flushed.
@@ -3192,6 +3222,8 @@ function abortTask(task: Task, request: Request, error: mixed): void {
3192
3222
}
3193
3223
encodeErrorForBoundary ( boundary , errorDigest , errorMessage , errorInfo ) ;
3194
3224
3225
+ untrackBoundary ( request , boundary ) ;
3226
+
3195
3227
if ( boundary . parentFlushed ) {
3196
3228
request . clientRenderedBoundaries . push ( boundary ) ;
3197
3229
}
0 commit comments