Skip to content

Commit

Permalink
[Flight] properly track pendingChunks when changing environment names
Browse files Browse the repository at this point in the history
When the environment name changes for a chunk we issue a new debug chunk which updates the environment name. This chunk was not beign included in the pendingChunks count so the count was off when flushing
  • Loading branch information
gnoff committed Sep 13, 2024
1 parent 94e4aca commit 9401f31
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3813,6 +3813,7 @@ function retryTask(request: Request, task: Task): void {
if (__DEV__) {
const currentEnv = (0, request.environmentName)();
if (currentEnv !== task.environmentName) {
request.pendingChunks++;
// The environment changed since we last emitted any debug information for this
// task. We emit an entry that just includes the environment name change.
emitDebugChunk(request, task.id, {env: currentEnv});
Expand All @@ -3831,6 +3832,7 @@ function retryTask(request: Request, task: Task): void {
if (__DEV__) {
const currentEnv = (0, request.environmentName)();
if (currentEnv !== task.environmentName) {
request.pendingChunks++;
// The environment changed since we last emitted any debug information for this
// task. We emit an entry that just includes the environment name change.
emitDebugChunk(request, task.id, {env: currentEnv});
Expand Down

0 comments on commit 9401f31

Please sign in to comment.