@@ -4762,6 +4762,27 @@ function abortTask(task: Task, request: Request, error: mixed): void {
47624762 }
47634763}
47644764
4765+ function abortTaskDEV ( task : Task , request : Request , error : mixed ) : void {
4766+ if ( __DEV__ ) {
4767+ const prevTaskInDEV = currentTaskInDEV ;
4768+ const prevGetCurrentStackImpl = ReactSharedInternals . getCurrentStack ;
4769+ setCurrentTaskInDEV ( task ) ;
4770+ ReactSharedInternals . getCurrentStack = getCurrentStackInDEV ;
4771+ try {
4772+ abortTask ( task , request , error ) ;
4773+ } finally {
4774+ setCurrentTaskInDEV ( prevTaskInDEV ) ;
4775+ ReactSharedInternals . getCurrentStack = prevGetCurrentStackImpl ;
4776+ }
4777+ } else {
4778+ // These errors should never make it into a build so we don't need to encode them in codes.json
4779+ // eslint-disable-next-line react-internal/prod-error-codes
4780+ throw new Error (
4781+ 'abortTaskDEV should never be called in production mode. This is a bug in React.' ,
4782+ ) ;
4783+ }
4784+ }
4785+
47654786function safelyEmitEarlyPreloads (
47664787 request : Request ,
47674788 shellComplete : boolean ,
@@ -6111,7 +6132,11 @@ export function abort(request: Request, reason: mixed): void {
61116132 // This error isn't necessarily fatal in this case but we need to stash it
61126133 // so we can use it to abort any pending work
61136134 request . fatalError = error ;
6114- abortableTasks . forEach ( task => abortTask ( task , request , error ) ) ;
6135+ if ( __DEV__ ) {
6136+ abortableTasks . forEach ( task => abortTaskDEV ( task , request , error ) ) ;
6137+ } else {
6138+ abortableTasks . forEach ( task => abortTask ( task , request , error ) ) ;
6139+ }
61156140 abortableTasks . clear ( ) ;
61166141 }
61176142 if ( request . destination !== null ) {
0 commit comments