Skip to content

Commit 7eb8234

Browse files
authored
[Flight] Fix double-incremented pending chunks counter (facebook#31833)
Before calling `emitTimingChunk` inside of `forwardDebugInfo`, we must not increment `request.pendingChunks`, as this is already done inside of the `emitTimingChunk` function. I don't have a unit test for this, but manually verified that this fixes the hanging responses in vercel/next.js#73804.
1 parent 2bd1c75 commit 7eb8234

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-server/src/ReactFlightServer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3810,11 +3810,11 @@ function forwardDebugInfo(
38103810
debugInfo: ReactDebugInfo,
38113811
) {
38123812
for (let i = 0; i < debugInfo.length; i++) {
3813-
request.pendingChunks++;
38143813
if (typeof debugInfo[i].time === 'number') {
38153814
// When forwarding time we need to ensure to convert it to the time space of the payload.
38163815
emitTimingChunk(request, id, debugInfo[i].time);
38173816
} else {
3817+
request.pendingChunks++;
38183818
if (typeof debugInfo[i].name === 'string') {
38193819
// We outline this model eagerly so that we can refer to by reference as an owner.
38203820
// If we had a smarter way to dedupe we might not have to do this if there ends up

0 commit comments

Comments
 (0)