@@ -263,7 +263,8 @@ function createPendingSegment(
263263function reportError ( request : Request , error : mixed ) : void {
264264 // If this callback errors, we intentionally let that error bubble up to become a fatal error
265265 // so that someone fixes the error reporting instead of hiding it.
266- request. onError ( error ) ;
266+ const onError = request . onError ;
267+ onError ( error ) ;
267268}
268269
269270function fatalError ( request : Request , error : mixed ) : void {
@@ -485,7 +486,8 @@ function erroredTask(
485486
486487 request . allPendingTasks -- ;
487488 if ( request . allPendingTasks === 0 ) {
488- request . onCompleteAll ( ) ;
489+ const onCompleteAll = request . onCompleteAll ;
490+ onCompleteAll ( ) ;
489491 }
490492}
491493
@@ -532,7 +534,8 @@ function abortTask(task: Task): void {
532534 }
533535
534536 if ( request . allPendingTasks === 0 ) {
535- request . onCompleteAll ( ) ;
537+ const onCompleteAll = request . onCompleteAll ;
538+ onCompleteAll ( ) ;
536539 }
537540 }
538541}
@@ -552,7 +555,8 @@ function finishedTask(
552555 }
553556 request . pendingRootTasks -- ;
554557 if ( request . pendingRootTasks === 0 ) {
555- request . onReadyToStream ( ) ;
558+ const onReadyToStream = request . onReadyToStream ;
559+ onReadyToStream ( ) ;
556560 }
557561 } else {
558562 boundary . pendingTasks -- ;
@@ -593,7 +597,8 @@ function finishedTask(
593597 if ( request . allPendingTasks === 0 ) {
594598 // This needs to be called at the very end so that we can synchronously write the result
595599 // in the callback if needed.
596- request . onCompleteAll ( ) ;
600+ const onCompleteAll = request . onCompleteAll ;
601+ onCompleteAll ( ) ;
597602 }
598603}
599604
0 commit comments