@@ -4151,6 +4151,27 @@ function abortTask(task: Task, request: Request, error: mixed): void {
4151
4151
}
4152
4152
}
4153
4153
4154
+ function abortTaskDEV ( task : Task , request : Request , error : mixed ) : void {
4155
+ if ( __DEV__ ) {
4156
+ const prevTaskInDEV = currentTaskInDEV ;
4157
+ const prevGetCurrentStackImpl = ReactSharedInternals . getCurrentStack ;
4158
+ setCurrentTaskInDEV ( task ) ;
4159
+ ReactSharedInternals . getCurrentStack = getCurrentStackInDEV ;
4160
+ try {
4161
+ abortTask ( task , request , error ) ;
4162
+ } finally {
4163
+ setCurrentTaskInDEV ( prevTaskInDEV ) ;
4164
+ ReactSharedInternals . getCurrentStack = prevGetCurrentStackImpl ;
4165
+ }
4166
+ } else {
4167
+ // These errors should never make it into a build so we don't need to encode them in codes.json
4168
+ // eslint-disable-next-line react-internal/prod-error-codes
4169
+ throw new Error (
4170
+ 'abortTaskDEV should never be called in production mode. This is a bug in React.' ,
4171
+ ) ;
4172
+ }
4173
+ }
4174
+
4154
4175
function safelyEmitEarlyPreloads (
4155
4176
request : Request ,
4156
4177
shellComplete : boolean ,
@@ -5373,7 +5394,11 @@ export function abort(request: Request, reason: mixed): void {
5373
5394
// This error isn't necessarily fatal in this case but we need to stash it
5374
5395
// so we can use it to abort any pending work
5375
5396
request . fatalError = error ;
5376
- abortableTasks . forEach ( task => abortTask ( task , request , error ) ) ;
5397
+ if ( __DEV__ ) {
5398
+ abortableTasks . forEach ( task => abortTaskDEV ( task , request , error ) ) ;
5399
+ } else {
5400
+ abortableTasks . forEach ( task => abortTask ( task , request , error ) ) ;
5401
+ }
5377
5402
abortableTasks . clear ( ) ;
5378
5403
}
5379
5404
if ( request . destination !== null ) {
0 commit comments