Skip to content

[enableInfiniteRenderLoopDetection] Warn about potential infinite loop, instead of interrupting#35999

Open
hoxyq wants to merge 1 commit intomainfrom
reconciler/warn-about-potential-infinite-render-loop
Open

[enableInfiniteRenderLoopDetection] Warn about potential infinite loop, instead of interrupting#35999
hoxyq wants to merge 1 commit intomainfrom
reconciler/warn-about-potential-infinite-render-loop

Conversation

@hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Mar 10, 2026

The enableInfiniteRenderLoopDetection feature flag is currently disabled everywhere. When attempted to roll out this at Meta, we've observed multiple false-positives, where counter-based approach would interrupt the render that would've resolved at some later iteration.

This change gates the scenarios that are only discovered with the instrumentation behind enableInfiniteRenderLoopDetection flag to warn about potential infinite loop, instead of throwing an error and hitting an error boundary. The main reason is to see if we can a signal on which possible area of scenarios this new approach to infinite loops covers.

The gist of the approach is to ensure that we are still throwing error and breaking the infinite loop, if we were doing this without enableInfiniteRenderLoopDetection feature flag enabled.

This will log multiple errors if there is an infinite loop, but this should be fine, and it also aligns with the pattern for warnings about passive effects infinite loop.

I've validated that tests in ReactUpdates-test.js are passing independently whether the feature flag is enabled or not.

@hoxyq hoxyq requested review from acdlite and rickhanlonii March 10, 2026 22:35
@meta-cla meta-cla bot added the CLA Signed label Mar 10, 2026
@react-sizebot
Copy link

react-sizebot commented Mar 10, 2026

Comparing: 014138d...ea77284

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 +0.03% 611.79 kB 611.94 kB +0.02% 108.12 kB 108.14 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% 677.72 kB 677.87 kB +0.02% 119.08 kB 119.11 kB
facebook-www/ReactDOM-prod.classic.js +0.04% 697.67 kB 697.93 kB +0.03% 122.58 kB 122.61 kB
facebook-www/ReactDOM-prod.modern.js +0.04% 687.98 kB 688.25 kB +0.03% 120.96 kB 120.99 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js +0.40% 67.70 kB 67.97 kB +0.39% 17.05 kB 17.12 kB

Generated by 🚫 dangerJS against ea77284

@hoxyq hoxyq force-pushed the reconciler/warn-about-potential-infinite-render-loop branch from 1675545 to 6f027a3 Compare March 11, 2026 01:16
@hoxyq hoxyq force-pushed the reconciler/warn-about-potential-infinite-render-loop branch from 6f027a3 to ea77284 Compare March 11, 2026 01:25
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.

2 participants