@@ -4151,6 +4151,27 @@ function abortTask(task: Task, request: Request, error: mixed): void {
41514151 }
41524152}
41534153
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+
41544175function safelyEmitEarlyPreloads (
41554176 request : Request ,
41564177 shellComplete : boolean ,
@@ -5373,7 +5394,11 @@ export function abort(request: Request, reason: mixed): void {
53735394 // This error isn't necessarily fatal in this case but we need to stash it
53745395 // so we can use it to abort any pending work
53755396 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+ }
53775402 abortableTasks . clear ( ) ;
53785403 }
53795404 if ( request . destination !== null ) {
0 commit comments