Repository: facebook/react
Pull request: [Flight] Include I/O not awaited in user space

If I/O is not awaited in user space in a "previous" path we used to just drop it on the floor. There's a few strategies we could apply here. My first commit just emits it without an await but that would mean we don't have an await stack when there's no I/O in a follow up.

I went with a strategy where the "previous" I/O is used only if the "next" didn't have I/O. This may still drop I/O on the floor if there's two back to back within internals for example. It would only log the first one even though the outer await may have started earlier.

It may also log deeper in the "next" path if that had user space stacks and then the outer await will appear as if it awaited after.

So it's not perfect.

Changed files:
filename: packages/react-server/src/ReactFlightServer.js
patch: @@ -2061,20 +2061,17 @@ function visitAsyncNode(
     return null;
   }
   visited.add(node);
+  let previousIONode = null;
   // First visit anything that blocked this sequence to start in the first place.
   if (node.previous !== null && node.end > request.timeOrigin) {
-    // We ignore the returned io nodes here because if it wasn't awaited in user space,
-    // then we don't log it. It also means that it can just have been part of a previous
-    // component's render.
-    // TODO: This means that some I/O can get lost that was still blocking the sequence.
-    const ioNode = visitAsyncNode(
+    previousIONode = visitAsyncNode(
       request,
       task,
       node.previous,
       visited,
       cutOff,
     );
-    if (ioNode === undefined) {
+    if (previousIONode === undefined) {
       // Undefined is used as a signal that we found a suitable aborted node and we don't have to find
       // further aborted nodes.
       return undefined;
@@ -2085,17 +2082,17 @@ function visitAsyncNode(
       return node;
     }
     case UNRESOLVED_PROMISE_NODE: {
-      return null;
+      return previousIONode;
     }
     case PROMISE_NODE: {
       if (node.end <= request.timeOrigin) {
         // This was already resolved when we started this render. It must have been either something
         // that's part of a start up sequence or externally cached data. We exclude that information.
         // The technique for debugging the effects of uncached data on the render is to simply uncache it.
-        return null;
+        return previousIONode;
       }
       const awaited = node.awaited;
-      let match = null;
+      let match: void | null | PromiseNode | IONode = previousIONode;
       if (awaited !== null) {
         const ioNode = visitAsyncNode(request, task, awaited, visited, cutOff);
         if (ioNode === undefined) {
@@ -2143,11 +2140,11 @@ function visitAsyncNode(
       return match;
     }
     case UNRESOLVED_AWAIT_NODE: {
-      return null;
+      return previousIONode;
     }
     case AWAIT_NODE: {
       const awaited = node.awaited;
-      let match = null;
+      let match: void | null | PromiseNode | IONode = previousIONode;
       if (awaited !== null) {
         const ioNode = visitAsyncNode(request, task, awaited, visited, cutOff);
         if (ioNode === undefined) {

filename: packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js
patch: @@ -112,7 +112,8 @@ function filterStackFrame(filename, functionName) {
     !filename.includes('node_modules') &&
     // Filter out our own internal source code since it'll typically be in node_modules
     (!filename.includes('/packages/') || filename.includes('/__tests__/')) &&
-    !filename.includes('/build/')
+    !filename.includes('/build/') &&
+    !functionName.includes('internal_')
   );
 }
 
@@ -233,9 +234,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                202,
+                203,
                 109,
-                182,
+                183,
                 50,
               ],
             ],
@@ -257,9 +258,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    202,
+                    203,
                     109,
-                    182,
+                    183,
                     50,
                   ],
                 ],
@@ -268,25 +269,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  184,
+                  185,
                   13,
-                  183,
+                  184,
                   5,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  191,
+                  192,
                   26,
-                  190,
+                  191,
                   5,
                 ],
               ],
@@ -305,9 +306,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Object.<anonymous>",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  202,
+                  203,
                   109,
-                  182,
+                  183,
                   50,
                 ],
               ],
@@ -316,17 +317,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "getData",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                184,
+                185,
                 13,
-                183,
+                184,
                 5,
               ],
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                191,
+                192,
                 26,
-                190,
+                191,
                 5,
               ],
             ],
@@ -351,9 +352,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    202,
+                    203,
                     109,
-                    182,
+                    183,
                     50,
                   ],
                 ],
@@ -362,25 +363,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  185,
+                  186,
                   21,
-                  183,
+                  184,
                   5,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  191,
+                  192,
                   20,
-                  190,
+                  191,
                   5,
                 ],
               ],
@@ -401,9 +402,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Object.<anonymous>",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  202,
+                  203,
                   109,
-                  182,
+                  183,
                   50,
                 ],
               ],
@@ -412,17 +413,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "getData",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                186,
+                187,
                 21,
-                183,
+                184,
                 5,
               ],
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                191,
+                192,
                 20,
-                190,
+                191,
                 5,
               ],
             ],
@@ -442,9 +443,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                193,
+                194,
                 60,
-                190,
+                191,
                 5,
               ],
             ],
@@ -466,9 +467,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    202,
+                    203,
                     109,
-                    182,
+                    183,
                     50,
                   ],
                 ],
@@ -477,17 +478,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  185,
+                  186,
                   21,
-                  183,
+                  184,
                   5,
                 ],
               ],
@@ -506,9 +507,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  193,
+                  194,
                   60,
-                  190,
+                  191,
                   5,
                 ],
               ],
@@ -517,9 +518,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "InnerComponent",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                199,
+                200,
                 35,
-                196,
+                197,
                 5,
               ],
             ],
@@ -593,9 +594,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                557,
+                558,
                 40,
-                538,
+                539,
                 49,
               ],
             ],
@@ -617,9 +618,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    557,
+                    558,
                     40,
-                    538,
+                    539,
                     49,
                   ],
                 ],
@@ -628,25 +629,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  540,
+                  541,
                   13,
-                  539,
+                  540,
                   5,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  545,
+                  546,
                   36,
-                  544,
+                  545,
                   5,
                 ],
               ],
@@ -665,9 +666,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Object.<anonymous>",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  557,
+                  558,
                   40,
-                  538,
+                  539,
                   49,
                 ],
               ],
@@ -676,17 +677,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "getData",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                540,
+                541,
                 13,
-                539,
+                540,
                 5,
               ],
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                545,
+                546,
                 36,
-                544,
+                545,
                 5,
               ],
             ],
@@ -706,9 +707,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                547,
+                548,
                 60,
-                544,
+                545,
                 5,
               ],
             ],
@@ -727,9 +728,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    557,
+                    558,
                     40,
-                    538,
+                    539,
                     49,
                   ],
                 ],
@@ -738,25 +739,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  540,
+                  541,
                   13,
-                  539,
+                  540,
                   5,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  546,
+                  547,
                   22,
-                  544,
+                  545,
                   5,
                 ],
               ],
@@ -775,9 +776,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  547,
+                  548,
                   60,
-                  544,
+                  545,
                   5,
                 ],
               ],
@@ -786,9 +787,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "InnerComponent",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                553,
+                554,
                 40,
-                550,
+                551,
                 5,
               ],
             ],
@@ -851,9 +852,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                820,
+                821,
                 109,
-                807,
+                808,
                 67,
               ],
             ],
@@ -872,9 +873,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    820,
+                    821,
                     109,
-                    807,
+                    808,
                     67,
                   ],
                 ],
@@ -883,9 +884,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  810,
+                  811,
                   7,
-                  808,
+                  809,
                   5,
                 ],
               ],
@@ -947,9 +948,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                916,
+                917,
                 109,
-                907,
+                908,
                 94,
               ],
             ],
@@ -1020,9 +1021,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                989,
+                990,
                 109,
-                965,
+                966,
                 50,
               ],
             ],
@@ -1104,9 +1105,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1073,
+                1074,
                 109,
-                1056,
+                1057,
                 63,
               ],
             ],
@@ -1123,17 +1124,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "fetchThirdParty",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                167,
+                168,
                 40,
-                165,
+                166,
                 3,
               ],
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1069,
+                1070,
                 24,
-                1068,
+                1069,
                 5,
               ],
             ],
@@ -1155,17 +1156,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "fetchThirdParty",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    167,
+                    168,
                     40,
-                    165,
+                    166,
                     3,
                   ],
                   [
                     "Component",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    1069,
+                    1070,
                     24,
-                    1068,
+                    1069,
                     5,
                   ],
                 ],
@@ -1174,25 +1175,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1058,
+                  1059,
                   13,
-                  1057,
+                  1058,
                   5,
                 ],
                 [
                   "ThirdPartyComponent",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1064,
+                  1065,
                   24,
-                  1063,
+                  1064,
                   5,
                 ],
               ],
@@ -1211,17 +1212,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "fetchThirdParty",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  167,
+                  168,
                   40,
-                  165,
+                  166,
                   3,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1069,
+                  1070,
                   24,
-                  1068,
+                  1069,
                   5,
                 ],
               ],
@@ -1230,17 +1231,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "getData",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1058,
+                1059,
                 13,
-                1057,
+                1058,
                 5,
               ],
               [
                 "ThirdPartyComponent",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1064,
+                1065,
                 24,
-                1063,
+                1064,
                 5,
               ],
             ],
@@ -1265,17 +1266,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "fetchThirdParty",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    167,
+                    168,
                     40,
-                    165,
+                    166,
                     3,
                   ],
                   [
                     "Component",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    1069,
+                    1070,
                     24,
-                    1068,
+                    1069,
                     5,
                   ],
                 ],
@@ -1284,25 +1285,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1059,
+                  1060,
                   13,
-                  1057,
+                  1058,
                   5,
                 ],
                 [
                   "ThirdPartyComponent",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1064,
+                  1065,
                   18,
-                  1063,
+                  1064,
                   5,
                 ],
               ],
@@ -1321,17 +1322,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "fetchThirdParty",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  167,
+                  168,
                   40,
-                  165,
+                  166,
                   3,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1069,
+                  1070,
                   24,
-                  1068,
+                  1069,
                   5,
                 ],
               ],
@@ -1340,17 +1341,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "getData",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1059,
+                1060,
                 13,
-                1057,
+                1058,
                 5,
               ],
               [
                 "ThirdPartyComponent",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1064,
+                1065,
                 18,
-                1063,
+                1064,
                 5,
               ],
             ],
@@ -1425,9 +1426,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1389,
+                1390,
                 40,
-                1372,
+                1373,
                 62,
               ],
             ],
@@ -1449,9 +1450,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    1389,
+                    1390,
                     40,
-                    1372,
+                    1373,
                     62,
                   ],
                 ],
@@ -1460,25 +1461,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1374,
+                  1375,
                   13,
-                  1373,
+                  1374,
                   25,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1384,
+                  1385,
                   13,
-                  1383,
+                  1384,
                   5,
                 ],
               ],
@@ -1497,9 +1498,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Object.<anonymous>",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1389,
+                  1390,
                   40,
-                  1372,
+                  1373,
                   62,
                 ],
               ],
@@ -1508,17 +1509,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "getData",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1374,
+                1375,
                 13,
-                1373,
+                1374,
                 25,
               ],
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1384,
+                1385,
                 13,
-                1383,
+                1384,
                 5,
               ],
             ],
@@ -1538,9 +1539,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1385,
+                1386,
                 60,
-                1383,
+                1384,
                 5,
               ],
             ],
@@ -1562,9 +1563,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    1389,
+                    1390,
                     40,
-                    1372,
+                    1373,
                     62,
                   ],
                 ],
@@ -1573,25 +1574,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1374,
+                  1375,
                   13,
-                  1373,
+                  1374,
                   25,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1384,
+                  1385,
                   13,
-                  1383,
+                  1384,
                   5,
                 ],
               ],
@@ -1610,9 +1611,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1385,
+                  1386,
                   60,
-                  1383,
+                  1384,
                   5,
                 ],
               ],
@@ -1621,9 +1622,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Child",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1379,
+                1380,
                 28,
-                1378,
+                1379,
                 5,
               ],
             ],
@@ -1694,9 +1695,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1658,
+                1659,
                 40,
-                1642,
+                1643,
                 57,
               ],
             ],
@@ -1718,9 +1719,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    1658,
+                    1659,
                     40,
-                    1642,
+                    1643,
                     57,
                   ],
                 ],
@@ -1729,25 +1730,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1644,
+                  1645,
                   13,
-                  1643,
+                  1644,
                   25,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1653,
+                  1654,
                   23,
-                  1652,
+                  1653,
                   5,
                 ],
               ],
@@ -1766,9 +1767,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Object.<anonymous>",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1658,
+                  1659,
                   40,
-                  1642,
+                  1643,
                   57,
                 ],
               ],
@@ -1777,17 +1778,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "getData",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1644,
+                1645,
                 13,
-                1643,
+                1644,
                 25,
               ],
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1653,
+                1654,
                 23,
-                1652,
+                1653,
                 5,
               ],
             ],
@@ -1807,9 +1808,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1654,
+                1655,
                 60,
-                1652,
+                1653,
                 5,
               ],
             ],
@@ -1828,9 +1829,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    1658,
+                    1659,
                     40,
-                    1642,
+                    1643,
                     57,
                   ],
                 ],
@@ -1839,25 +1840,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1644,
+                  1645,
                   13,
-                  1643,
+                  1644,
                   25,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1653,
+                  1654,
                   23,
-                  1652,
+                  1653,
                   5,
                 ],
               ],
@@ -1936,9 +1937,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1900,
+                1901,
                 40,
-                1882,
+                1883,
                 80,
               ],
             ],
@@ -1960,9 +1961,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    1900,
+                    1901,
                     40,
-                    1882,
+                    1883,
                     80,
                   ],
                 ],
@@ -1971,25 +1972,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "delayTrice",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1890,
+                  1891,
                   13,
-                  1888,
+                  1889,
                   5,
                 ],
                 [
                   "Bar",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1895,
+                  1896,
                   13,
-                  1894,
+                  1895,
                   5,
                 ],
               ],
@@ -2008,9 +2009,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Object.<anonymous>",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1900,
+                  1901,
                   40,
-                  1882,
+                  1883,
                   80,
                 ],
               ],
@@ -2019,17 +2020,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "delayTrice",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1890,
+                1891,
                 13,
-                1888,
+                1889,
                 5,
               ],
               [
                 "Bar",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1895,
+                1896,
                 13,
-                1894,
+                1895,
                 5,
               ],
             ],
@@ -2051,9 +2052,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    1900,
+                    1901,
                     40,
-                    1882,
+                    1883,
                     80,
                   ],
                 ],
@@ -2062,33 +2063,33 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "delayTwice",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1884,
+                  1885,
                   13,
-                  1883,
+                  1884,
                   5,
                 ],
                 [
                   "delayTrice",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1889,
+                  1890,
                   15,
-                  1888,
+                  1889,
                   5,
                 ],
                 [
                   "Bar",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1895,
+                  1896,
                   13,
-                  1894,
+                  1895,
                   5,
                 ],
               ],
@@ -2107,9 +2108,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Object.<anonymous>",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1900,
+                  1901,
                   40,
-                  1882,
+                  1883,
                   80,
                 ],
               ],
@@ -2118,25 +2119,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "delayTwice",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1884,
+                1885,
                 13,
-                1883,
+                1884,
                 5,
               ],
               [
                 "delayTrice",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1889,
+                1890,
                 15,
-                1888,
+                1889,
                 5,
               ],
               [
                 "Bar",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1895,
+                1896,
                 13,
-                1894,
+                1895,
                 5,
               ],
             ],
@@ -2158,9 +2159,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    1900,
+                    1901,
                     40,
-                    1882,
+                    1883,
                     80,
                   ],
                 ],
@@ -2169,17 +2170,17 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "delayTwice",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1885,
+                  1886,
                   13,
-                  1883,
+                  1884,
                   5,
                 ],
               ],
@@ -2198,9 +2199,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Object.<anonymous>",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  1900,
+                  1901,
                   40,
-                  1882,
+                  1883,
                   80,
                 ],
               ],
@@ -2209,9 +2210,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "delayTwice",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                1885,
+                1886,
                 13,
-                1883,
+                1884,
                 5,
               ],
             ],
@@ -2272,9 +2273,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "Object.<anonymous>",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                2241,
+                2242,
                 109,
-                2230,
+                2231,
                 58,
               ],
             ],
@@ -2296,9 +2297,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                   [
                     "Object.<anonymous>",
                     "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                    2241,
+                    2242,
                     109,
-                    2230,
+                    2231,
                     58,
                   ],
                 ],
@@ -2307,25 +2308,25 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "delay",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  160,
+                  161,
                   12,
-                  159,
+                  160,
                   3,
                 ],
                 [
                   "getData",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  2232,
+                  2233,
                   14,
-                  2231,
+                  2232,
                   5,
                 ],
                 [
                   "Component",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  2238,
+                  2239,
                   20,
-                  2237,
+                  2238,
                   5,
                 ],
               ],
@@ -2344,9 +2345,9 @@ describe('ReactFlightAsyncDebugInfo', () => {
                 [
                   "Object.<anonymous>",
                   "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                  2241,
+                  2242,
                   109,
-                  2230,
+                  2231,
                   58,
                 ],
               ],
@@ -2355,17 +2356,161 @@ describe('ReactFlightAsyncDebugInfo', () => {
               [
                 "getData",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
-                2232,
+                2233,
                 23,
-                2231,
+                2232,
                 5,
               ],
               [
                 "Component",
                 "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
+                2239,
+                20,
                 2238,
+                5,
+              ],
+            ],
+          },
+          {
+            "time": 0,
+          },
+          {
+            "time": 0,
+          },
+        ]
+      `);
+    }
+  });
+
+  it('can track IO that is not awaited in user space', async () => {
+    function internal_API(text) {
+      return delay(1).then(async () => {
+        return text.toUpperCase();
+      });
+    }
+
+    async function Component({text, promise}) {
+      return await internal_API('hi, seb');
+    }
+
+    const stream = ReactServerDOMServer.renderToPipeableStream(
+      <Component />,
+      {},
+      {
+        filterStackFrame,
+      },
+    );
+
+    const readable = new Stream.PassThrough(streamOptions);
+
+    const result = ReactServerDOMClient.createFromNodeStream(readable, {
+      moduleMap: {},
+      moduleLoading: {},
+    });
+    stream.pipe(readable);
+
+    expect(await result).toBe('HI, SEB');
+
+    await finishLoadingStream(readable);
+    if (
+      __DEV__ &&
+      gate(
+        flags =>
+          flags.enableComponentPerformanceTrack && flags.enableAsyncDebugInfo,
+      )
+    ) {
+      expect(getDebugInfo(result)).toMatchInlineSnapshot(`
+        [
+          {
+            "time": 0,
+          },
+          {
+            "env": "Server",
+            "key": null,
+            "name": "Component",
+            "props": {},
+            "stack": [
+              [
+                "Object.<anonymous>",
+                "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
+                2397,
+                40,
+                2385,
+                56,
+              ],
+            ],
+          },
+          {
+            "time": 0,
+          },
+          {
+            "awaited": {
+              "end": 0,
+              "env": "Server",
+              "name": "delay",
+              "owner": {
+                "env": "Server",
+                "key": null,
+                "name": "Component",
+                "props": {},
+                "stack": [
+                  [
+                    "Object.<anonymous>",
+                    "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
+                    2397,
+                    40,
+                    2385,
+                    56,
+                  ],
+                ],
+              },
+              "stack": [
+                [
+                  "delay",
+                  "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
+                  161,
+                  12,
+                  160,
+                  3,
+                ],
+                [
+                  "Component",
+                  "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
+                  2393,
+                  20,
+                  2392,
+                  5,
+                ],
+              ],
+              "start": 0,
+              "value": {
+                "value": "HI, SEB",
+              },
+            },
+            "env": "Server",
+            "owner": {
+              "env": "Server",
+              "key": null,
+              "name": "Component",
+              "props": {},
+              "stack": [
+                [
+                  "Object.<anonymous>",
+                  "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
+                  2397,
+                  40,
+                  2385,
+                  56,
+                ],
+              ],
+            },
+            "stack": [
+              [
+                "Component",
+                "/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
+                2393,
                 20,
-                2237,
+                2392,
                 5,
               ],
             ],