@@ -1880,7 +1880,7 @@ function visitAsyncNode(
18801880 request : Request ,
18811881 task : Task ,
18821882 node : AsyncSequence ,
1883- visited : Set < AsyncSequence > ,
1883+ visited : Set < AsyncSequence | ReactDebugInfo > ,
18841884 cutOff : number ,
18851885) : null | PromiseNode | IONode {
18861886 if ( visited . has ( node ) ) {
@@ -1939,7 +1939,8 @@ function visitAsyncNode(
19391939 // We need to forward after we visit awaited nodes because what ever I/O we requested that's
19401940 // the thing that generated this node and its virtual children.
19411941 const debugInfo = node . debugInfo ;
1942- if ( debugInfo !== null ) {
1942+ if ( debugInfo !== null && ! visited . has ( debugInfo ) ) {
1943+ visited . add ( debugInfo ) ;
19431944 forwardDebugInfo ( request , task , debugInfo ) ;
19441945 }
19451946 return match ;
@@ -1999,8 +2000,9 @@ function visitAsyncNode(
19992000 }
20002001 // We need to forward after we visit awaited nodes because what ever I/O we requested that's
20012002 // the thing that generated this node and its virtual children.
2002- const debugInfo : null | ReactDebugInfo = node . debugInfo ;
2003- if ( debugInfo !== null ) {
2003+ const debugInfo = node . debugInfo ;
2004+ if ( debugInfo !== null && ! visited . has ( debugInfo ) ) {
2005+ visited . add ( debugInfo ) ;
20042006 forwardDebugInfo ( request , task , debugInfo ) ;
20052007 }
20062008 return match ;
@@ -2016,8 +2018,12 @@ function emitAsyncSequence(
20162018 request : Request ,
20172019 task : Task ,
20182020 node : AsyncSequence ,
2021+ alreadyForwardedDebugInfo : ?ReactDebugInfo ,
20192022) : void {
2020- const visited : Set < AsyncSequence > = new Set ( ) ;
2023+ const visited : Set < AsyncSequence | ReactDebugInfo > = new Set ( ) ;
2024+ if ( __DEV__ && alreadyForwardedDebugInfo ) {
2025+ visited . add ( alreadyForwardedDebugInfo ) ;
2026+ }
20212027 const awaitedNode = visitAsyncNode ( request , task , node , visited , task . time ) ;
20222028 if ( awaitedNode !== null ) {
20232029 // Nothing in user space (unfiltered stack) awaited this.
@@ -4311,9 +4317,10 @@ function forwardDebugInfoFromThenable(
43114317 task : Task ,
43124318 thenable : Thenable < any > ,
43134319): void {
4320+ let debugInfo : ?ReactDebugInfo ;
43144321 if ( __DEV__ ) {
43154322 // If this came from Flight, forward any debug info into this new row.
4316- const debugInfo : ? ReactDebugInfo = thenable . _debugInfo ;
4323+ debugInfo = thenable . _debugInfo ;
43174324 if ( debugInfo ) {
43184325 forwardDebugInfo ( request , task , debugInfo ) ;
43194326 }
@@ -4325,7 +4332,7 @@ function forwardDebugInfoFromThenable(
43254332 ) {
43264333 const sequence = getAsyncSequenceFromPromise ( thenable ) ;
43274334 if ( sequence !== null ) {
4328- emitAsyncSequence ( request , task , sequence ) ;
4335+ emitAsyncSequence ( request , task , sequence , debugInfo ) ;
43294336 }
43304337 }
43314338}
@@ -4335,9 +4342,10 @@ function forwardDebugInfoFromCurrentContext(
43354342 task: Task,
43364343 thenable: Thenable< any > ,
43374344): void {
4345+ let debugInfo : ?ReactDebugInfo ;
43384346 if ( __DEV__ ) {
43394347 // If this came from Flight, forward any debug info into this new row.
4340- const debugInfo : ? ReactDebugInfo = thenable . _debugInfo ;
4348+ debugInfo = thenable . _debugInfo ;
43414349 if ( debugInfo ) {
43424350 forwardDebugInfo ( request , task , debugInfo ) ;
43434351 }
@@ -4349,7 +4357,7 @@ function forwardDebugInfoFromCurrentContext(
43494357 ) {
43504358 const sequence = getCurrentAsyncSequence ( ) ;
43514359 if ( sequence !== null ) {
4352- emitAsyncSequence ( request , task , sequence ) ;
4360+ emitAsyncSequence ( request , task , sequence , debugInfo ) ;
43534361 }
43544362 }
43554363}
0 commit comments