@@ -2299,6 +2299,14 @@ function visitAsyncNode(
22992299 // Undefined is used as a signal that we found a suitable aborted node and we don't have to find
23002300 // further aborted nodes.
23012301 return undefined ;
2302+ }
2303+ if ( request . status === ABORTING ) {
2304+ if ( node . start < request . abortTime && node . end > request . abortTime ) {
2305+ // We aborted this render. If this Promise spanned the abort time it was probably the
2306+ // Promise that was aborted. This won't necessarily have I/O associated with it but
2307+ // it's a point of interest.
2308+ match = node ;
2309+ }
23022310 } else if ( ioNode !== null ) {
23032311 // This Promise was blocked on I/O. That's a signal that this Promise is interesting to log.
23042312 // We don't log it yet though. We return it to be logged by the point where it's awaited.
@@ -2319,18 +2327,6 @@ function visitAsyncNode(
23192327 } else {
23202328 match = node ;
23212329 }
2322- } else if (request.status === ABORTING) {
2323- if ( node . start < request . abortTime && node . end > request . abortTime ) {
2324- // We aborted this render. If this Promise spanned the abort time it was probably the
2325- // Promise that was aborted. This won't necessarily have I/O associated with it but
2326- // it's a point of interest.
2327- if (
2328- node . stack !== null &&
2329- hasUnfilteredFrame ( request , node . stack )
2330- ) {
2331- match = node ;
2332- }
2333- }
23342330 }
23352331 }
23362332 // We need to forward after we visit awaited nodes because what ever I/O we requested that's
@@ -5340,9 +5336,16 @@ function forwardDebugInfoFromCurrentContext(
53405336 }
53415337 }
53425338 if ( enableProfilerTimer && enableAsyncDebugInfo ) {
5343- const sequence = getCurrentAsyncSequence ( ) ;
5344- if ( sequence !== null ) {
5345- emitAsyncSequence ( request , task , sequence , debugInfo , null , null ) ;
5339+ if ( request . status === ABORTING ) {
5340+ // When aborting, skip forwarding debug info here.
5341+ // forwardDebugInfoFromAbortedTask will handle it more accurately.
5342+ } else {
5343+ // For normal resolve/reject, use the current execution context, as it
5344+ // shows what actually caused the Promise to settle.
5345+ const sequence = getCurrentAsyncSequence ( ) ;
5346+ if ( sequence !== null ) {
5347+ emitAsyncSequence ( request , task , sequence , debugInfo , null , null ) ;
5348+ }
53465349 }
53475350 }
53485351}
0 commit comments