@samitouri / QOS-React / commits / d8c90fa48d

Disable infinite render loop detection (#31088)

We're seeing issues with this feature internally including bugs with sibling prerendering and errors that are difficult for developers to action on. We'll turn off the feature for the time being until we can improve the stability and ergonomics. This PR does two things: - Turn off `enableInfiniteLoopDetection` everywhere while leaving it as a variant on www so we can do further experimentation. - Revert https://github.com/facebook/react/pull/31061 which was a temporary change for debugging. This brings the feature back to baseline.

Jack Pope committed Oct 1, 2024 at 11:00 UTC d8c90fa48d3addefe4b805ec56a3c65e4ee39127
7 files changed +13 -13
packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js
+1 -1
@@ -1427,7 +1427,7 @@ describe('ReactLegacyUpdates', () => {
1427 }
1428 }
1429
1430 - let limit = 105;
1430 + let limit = 55;
1431 await expect(async () => {
1432 await act(() => {
1433 ReactDOM.render(<EventuallyTerminating ref={ref} />, container);
packages/react-dom/src/__tests__/ReactUpdates-test.js
+1 -1
@@ -1542,7 +1542,7 @@ describe('ReactUpdates', () => {
1542 }
1543 }
1544
1545 - let limit = 105;
1545 + let limit = 55;
1546 const root = ReactDOMClient.createRoot(container);
1547 await expect(async () => {
1548 await act(() => {
packages/react-reconciler/src/ReactFiberWorkLoop.js
+2 -2
@@ -608,13 +608,13 @@ let pendingPassiveEffectsRenderEndTime: number = -0; // Profiling-only
608 let pendingPassiveTransitions: Array<Transition> | null = null;
609
610 // Use these to prevent an infinite loop of nested updates
611 -const NESTED_UPDATE_LIMIT = 100;
611 +const NESTED_UPDATE_LIMIT = 50;
612 let nestedUpdateCount: number = 0;
613 let rootWithNestedUpdates: FiberRoot | null = null;
614 let isFlushingPassiveEffects = false;
615 let didScheduleUpdateDuringPassiveEffects = false;
616
617 -const NESTED_PASSIVE_UPDATE_LIMIT = 100;
617 +const NESTED_PASSIVE_UPDATE_LIMIT = 50;
618 let nestedPassiveUpdateCount: number = 0;
619 let rootWithPassiveNestedUpdates: FiberRoot | null = null;
620
packages/shared/ReactFeatureFlags.js
+6 -6
@@ -157,6 +157,12 @@ export const retryLaneExpirationMs = 5000;
157 export const syncLaneExpirationMs = 250;
158 export const transitionLaneExpirationMs = 5000;
159
160 +/**
161 + * Enables a new error detection for infinite render loops from updates caused
162 + * by setState or similar outside of the component owning the state.
163 + */
164 +export const enableInfiniteRenderLoopDetection = false;
165 +
166 // -----------------------------------------------------------------------------
167 // Ready for next major.
168 //
@@ -204,12 +210,6 @@ export const enableFilterEmptyStringAttributesDOM = true;
210 // Disabled caching behavior of `react/cache` in client runtimes.
211 export const disableClientCache = true;
212
207 -/**
208 - * Enables a new error detection for infinite render loops from updates caused
209 - * by setState or similar outside of the component owning the state.
210 - */
211 -export const enableInfiniteRenderLoopDetection = true;
212 -
213 // Subtle breaking changes to JSX runtime to make it faster, like passing `ref`
214 // as a normal prop instead of stripping it from the props object.
215
packages/shared/forks/ReactFeatureFlags.native-fb.js
+1 -1
@@ -60,7 +60,7 @@ export const enableFizzExternalRuntime = true;
60 export const enableFlightReadableStream = true;
61 export const enableGetInspectorDataForInstanceInProduction = true;
62 export const enableHalt = false;
63 -export const enableInfiniteRenderLoopDetection = true;
63 +export const enableInfiniteRenderLoopDetection = false;
64 export const enableContextProfiling = false;
65 export const enableLazyContextPropagation = true;
66 export const enableLegacyCache = false;
packages/shared/forks/ReactFeatureFlags.native-oss.js
+1 -1
@@ -51,7 +51,7 @@ export const enableFlightReadableStream = true;
51 export const enableGetInspectorDataForInstanceInProduction = false;
52 export const enableHalt = false;
53 export const enableHiddenSubtreeInsertionEffectCleanup = false;
54 -export const enableInfiniteRenderLoopDetection = true;
54 +export const enableInfiniteRenderLoopDetection = false;
55 export const enableLazyContextPropagation = true;
56 export const enableContextProfiling = false;
57 export const enableLegacyCache = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js
+1 -1
@@ -41,7 +41,7 @@ export const enableFizzExternalRuntime = true;
41 export const enableFlightReadableStream = true;
42 export const enableGetInspectorDataForInstanceInProduction = false;
43 export const enableHalt = false;
44 -export const enableInfiniteRenderLoopDetection = true;
44 +export const enableInfiniteRenderLoopDetection = false;
45 export const enableLazyContextPropagation = true;
46 export const enableContextProfiling = false;
47 export const enableHiddenSubtreeInsertionEffectCleanup = true;