Skip to content

Commit 515b922

Browse files
committed
Don't visit the same exact I/O node if we have already emitted an await
1 parent 2b676c1 commit 515b922

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/react-server/src/ReactFlightServer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,6 +2505,10 @@ function visitAsyncNodeImpl(
25052505
// Promise that was ultimately awaited by the user space await.
25062506
serializeIONode(request, ioNode, awaited.promise);
25072507

2508+
// If we ever visit this I/O node again, skip it because we already emitted this
2509+
// exact entry and we don't need two awaits on the same thing.
2510+
visited.set(ioNode, null);
2511+
25082512
// Ensure the owner is already outlined.
25092513
if (node.owner != null) {
25102514
outlineComponentInfo(request, node.owner);

0 commit comments

Comments
 (0)