Skip to content

[enableInfiniteRenderLoopDetection] Add a flag to force throwing#36357

Merged
hoxyq merged 1 commit intomainfrom
infinite-render-loop/flag-to-force
Apr 29, 2026
Merged

[enableInfiniteRenderLoopDetection] Add a flag to force throwing#36357
hoxyq merged 1 commit intomainfrom
infinite-render-loop/flag-to-force

Conversation

@hoxyq
Copy link
Copy Markdown
Contributor

@hoxyq hoxyq commented Apr 27, 2026

Adds a enableInfiniteRenderLoopDetectionForceThrow flag, which changes the detection mechanism behaviour to start throwing, when the loop is observed. By default, the value is set to false, also made dynamic from the start for www.

@meta-cla meta-cla Bot added the CLA Signed label Apr 27, 2026
@react-sizebot
Copy link
Copy Markdown

Comparing: 561ed52...e0d7acf

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 = 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.02% 612.85 kB 612.96 kB +0.02% 108.29 kB 108.32 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 +0.02% 678.78 kB 678.89 kB +0.02% 119.26 kB 119.28 kB
facebook-www/ReactDOM-prod.classic.js +0.11% 698.52 kB 699.31 kB +0.10% 122.73 kB 122.84 kB
facebook-www/ReactDOM-prod.modern.js +0.12% 688.83 kB 689.63 kB +0.10% 121.11 kB 121.23 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against e0d7acf

@hoxyq hoxyq requested review from jackpope and rickhanlonii April 27, 2026 16:17
@hoxyq hoxyq marked this pull request as ready for review April 27, 2026 16:18
if (
isFromInfiniteRenderLoopDetectionInstrumentation ||
(executionContext & RenderContext && workInProgressRoot !== null)
(executionContext & RenderContext) !== NoContext
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we dropping the check on workInProgressRoot?

Copy link
Copy Markdown
Contributor Author

@hoxyq hoxyq Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not have any difference and can be treated as forward-fix. executionContext & RenderContext check implies the workInProgressRoot presence.

This was initially introduced in #26625 and it was used for gating the update of the errorRecoveryDisabledLanes for this root, and it is required to satisfy Flow checks.

The current setup follows the same logic: if the current execution context is render context, and the working root is present, we will disable the recovery lanes, and then we will throw the error no matter what. In our case throwing is gated behind enableInfiniteRenderLoopDetectionForceThrow, which is introduced in this PR.

@hoxyq hoxyq merged commit f4e0d4e into main Apr 29, 2026
247 checks passed
@hoxyq hoxyq deleted the infinite-render-loop/flag-to-force branch April 29, 2026 20:13
github-actions Bot pushed a commit that referenced this pull request Apr 29, 2026
)

Adds a `enableInfiniteRenderLoopDetectionForceThrow` flag, which changes
the detection mechanism behaviour to start throwing, when the loop is
observed. By default, the value is set to `false`, also made dynamic
from the start for `www`.

DiffTrain build for [f4e0d4e](f4e0d4e)
github-actions Bot pushed a commit to ozhankaya/react that referenced this pull request Apr 30, 2026
…ebook#36357)

Adds a `enableInfiniteRenderLoopDetectionForceThrow` flag, which changes
the detection mechanism behaviour to start throwing, when the loop is
observed. By default, the value is set to `false`, also made dynamic
from the start for `www`.

DiffTrain build for [f4e0d4e](facebook@f4e0d4e)
github-actions Bot pushed a commit to ozhankaya/react that referenced this pull request Apr 30, 2026
…ebook#36357)

Adds a `enableInfiniteRenderLoopDetectionForceThrow` flag, which changes
the detection mechanism behaviour to start throwing, when the loop is
observed. By default, the value is set to `false`, also made dynamic
from the start for `www`.

DiffTrain build for [f4e0d4e](facebook@f4e0d4e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants