Skip to content

[Fizz] prevent reentrant finishedTask from calling completeAll multiple times#36287

Merged
gnoff merged 1 commit intofacebook:mainfrom
gnoff:jstory/fix-reentrant-finishedtask
Apr 16, 2026
Merged

[Fizz] prevent reentrant finishedTask from calling completeAll multiple times#36287
gnoff merged 1 commit intofacebook:mainfrom
gnoff:jstory/fix-reentrant-finishedtask

Conversation

@gnoff
Copy link
Copy Markdown
Collaborator

@gnoff gnoff commented Apr 16, 2026

It is possible for the fallback tasks from a Suspense boundary to trigger an early completeAll call which is later repeated due to finishedTask reentrancy. For node.js in particular this might be problematic since we invoke a callback on each completeAll call but in general it just isn't the right semantics since the call is running slightly earlier than the completion of the last finishedTask invocation. This change ensures that any reentrant finishedTask calls (due to soft aborting fallback tasks) omit the completeAll call by temporarily incrementing the total pending tasks.

…le times

It is possible for the fallback tasks from a Suspense boundary to trigger an early completeAll() call which is later repeated due to finishedTask reentrancy. For node.js in particular this might be problematic since we invoke a callback on each completeAll() call but in general it just isn't the right semantics since the call is running slightly earlier than the completion of the last finishedTask invocation. This change ensures that any reentrant finishedTask calls (due to soft aborting fallback tasks) omit the completeAll() call by temporarily incrementing the total pending tasks.
@meta-cla meta-cla bot added the CLA Signed label Apr 16, 2026
@gnoff gnoff requested review from eps1lon and unstubbable April 16, 2026 17:58
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Apr 16, 2026
@react-sizebot
Copy link
Copy Markdown

Comparing: 56922cf...6285505

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB +0.05% 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 612.91 kB 612.91 kB = 108.30 kB 108.30 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 678.85 kB 678.85 kB = 119.27 kB 119.27 kB
facebook-www/ReactDOM-prod.classic.js = 698.58 kB 698.58 kB = 122.74 kB 122.74 kB
facebook-www/ReactDOM-prod.modern.js = 688.90 kB 688.90 kB = 121.12 kB 121.12 kB
react-native/shims/ReactNative.js New file 0.00 kB 0.60 kB New file 0.00 kB 0.34 kB
react-native/shims/ReactNativeTypes.js +18.74% 5.99 kB 7.11 kB +9.82% 1.81 kB 1.99 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
react-native/shims/ReactNative.js New file 0.00 kB 0.60 kB New file 0.00 kB 0.34 kB
react-native/shims/ReactNativeTypes.js +18.74% 5.99 kB 7.11 kB +9.82% 1.81 kB 1.99 kB
react-native/implementations/ReactFabric-dev.js +0.46% 776.87 kB 780.44 kB +0.56% 124.50 kB 125.19 kB
react-native/implementations/ReactFabric-dev.fb.js +0.44% 814.21 kB 817.78 kB +0.51% 130.36 kB 131.03 kB
test_utils/ReactAllWarnings.js +0.40% 68.30 kB 68.58 kB +0.56% 17.17 kB 17.27 kB
react-native/implementations/ReactFabric-prod.js +0.28% 399.26 kB 400.36 kB +0.20% 68.94 kB 69.08 kB
react-native/implementations/ReactFabric-prod.fb.js +0.26% 422.92 kB 424.02 kB +0.19% 73.13 kB 73.27 kB
react-native/implementations/ReactFabric-profiling.js +0.24% 466.15 kB 467.25 kB +0.17% 78.60 kB 78.73 kB
react-native/implementations/ReactFabric-profiling.fb.js +0.22% 496.38 kB 497.48 kB +0.18% 83.79 kB 83.94 kB

Generated by 🚫 dangerJS against 6285505

@gnoff gnoff merged commit ea67920 into facebook:main Apr 16, 2026
242 checks passed
@gnoff gnoff deleted the jstory/fix-reentrant-finishedtask branch April 16, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants