@samitouri / QOS-React-1 / commits / 6774caa379

[Flight] properly track pendingChunks when changing environment names (#30958)

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

Josh Story committed Sep 13, 2024 at 15:55 UTC 6774caa37973e3e26d60f100971e5e785fd12235
1 file changed +2
packages/react-server/src/ReactFlightServer.js
+2
@@ -3813,6 +3813,7 @@ function retryTask(request: Request, task: Task): void {
3813 if (__DEV__) {
3814 const currentEnv = (0, request.environmentName)();
3815 if (currentEnv !== task.environmentName) {
3816 + request.pendingChunks++;
3817 // The environment changed since we last emitted any debug information for this
3818 // task. We emit an entry that just includes the environment name change.
3819 emitDebugChunk(request, task.id, {env: currentEnv});
@@ -3831,6 +3832,7 @@ function retryTask(request: Request, task: Task): void {
3832 if (__DEV__) {
3833 const currentEnv = (0, request.environmentName)();
3834 if (currentEnv !== task.environmentName) {
3835 + request.pendingChunks++;
3836 // The environment changed since we last emitted any debug information for this
3837 // task. We emit an entry that just includes the environment name change.
3838 emitDebugChunk(request, task.id, {env: currentEnv});