Skip to content

Commit ad831d1

Browse files
committed
Switch to use()
The owner/stack disappears in this case because the use() is not a real await.
1 parent 2795ab8 commit ad831d1

File tree

1 file changed

+6
-35
lines changed

1 file changed

+6
-35
lines changed

packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -501,16 +501,16 @@ describe('ReactFlightAsyncDebugInfo', () => {
501501
return text.toUpperCase();
502502
}
503503

504-
async function Component() {
505-
const result = await getData('hi');
504+
function Component() {
505+
const result = ReactServer.use(getData('hi'));
506506
const moreData = getData('seb');
507507
return <InnerComponent text={result} promise={moreData} />;
508508
}
509509

510-
async function InnerComponent({text, promise}) {
510+
function InnerComponent({text, promise}) {
511511
// This async function depends on the I/O in parent components but it should not
512512
// include that I/O as part of its own meta data.
513-
return text + ', ' + (await promise);
513+
return text + ', ' + ReactServer.use(promise);
514514
}
515515

516516
const stream = ReactServerDOMServer.renderToPipeableStream(
@@ -603,7 +603,7 @@ describe('ReactFlightAsyncDebugInfo', () => {
603603
"Component",
604604
"/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
605605
505,
606-
26,
606+
36,
607607
504,
608608
5,
609609
],
@@ -640,7 +640,7 @@ describe('ReactFlightAsyncDebugInfo', () => {
640640
"Component",
641641
"/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
642642
505,
643-
26,
643+
36,
644644
504,
645645
5,
646646
],
@@ -668,9 +668,6 @@ describe('ReactFlightAsyncDebugInfo', () => {
668668
],
669669
],
670670
},
671-
{
672-
"time": 0,
673-
},
674671
{
675672
"awaited": {
676673
"end": 0,
@@ -721,32 +718,6 @@ describe('ReactFlightAsyncDebugInfo', () => {
721718
"start": 0,
722719
},
723720
"env": "Server",
724-
"owner": {
725-
"env": "Server",
726-
"key": null,
727-
"name": "InnerComponent",
728-
"props": {},
729-
"stack": [
730-
[
731-
"Component",
732-
"/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
733-
507,
734-
60,
735-
504,
736-
5,
737-
],
738-
],
739-
},
740-
"stack": [
741-
[
742-
"InnerComponent",
743-
"/packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js",
744-
513,
745-
35,
746-
510,
747-
5,
748-
],
749-
],
750721
},
751722
{
752723
"time": 0,

0 commit comments

Comments
 (0)