@@ -263,7 +263,8 @@ function createPendingSegment(
263
263
function reportError ( request : Request , error : mixed ) : void {
264
264
// If this callback errors, we intentionally let that error bubble up to become a fatal error
265
265
// so that someone fixes the error reporting instead of hiding it.
266
- request. onError ( error ) ;
266
+ const onError = request . onError ;
267
+ onError ( error ) ;
267
268
}
268
269
269
270
function fatalError ( request : Request , error : mixed ) : void {
@@ -485,7 +486,8 @@ function erroredTask(
485
486
486
487
request . allPendingTasks -- ;
487
488
if ( request . allPendingTasks === 0 ) {
488
- request . onCompleteAll ( ) ;
489
+ const onCompleteAll = request . onCompleteAll ;
490
+ onCompleteAll ( ) ;
489
491
}
490
492
}
491
493
@@ -532,7 +534,8 @@ function abortTask(task: Task): void {
532
534
}
533
535
534
536
if ( request . allPendingTasks === 0 ) {
535
- request . onCompleteAll ( ) ;
537
+ const onCompleteAll = request . onCompleteAll ;
538
+ onCompleteAll ( ) ;
536
539
}
537
540
}
538
541
}
@@ -552,7 +555,8 @@ function finishedTask(
552
555
}
553
556
request . pendingRootTasks -- ;
554
557
if ( request . pendingRootTasks === 0 ) {
555
- request . onReadyToStream ( ) ;
558
+ const onReadyToStream = request . onReadyToStream ;
559
+ onReadyToStream ( ) ;
556
560
}
557
561
} else {
558
562
boundary . pendingTasks -- ;
@@ -593,7 +597,8 @@ function finishedTask(
593
597
if ( request . allPendingTasks === 0 ) {
594
598
// This needs to be called at the very end so that we can synchronously write the result
595
599
// in the callback if needed.
596
- request . onCompleteAll ( ) ;
600
+ const onCompleteAll = request . onCompleteAll ;
601
+ onCompleteAll ( ) ;
597
602
}
598
603
}
599
604
0 commit comments