Skip to content

Commit d8c90fa

Browse files
authored
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 #31061 which was a temporary change for debugging. This brings the feature back to baseline.
1 parent 6e61258 commit d8c90fa

7 files changed

+13
-13
lines changed

packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ describe('ReactLegacyUpdates', () => {
14271427
}
14281428
}
14291429

1430-
let limit = 105;
1430+
let limit = 55;
14311431
await expect(async () => {
14321432
await act(() => {
14331433
ReactDOM.render(<EventuallyTerminating ref={ref} />, container);

packages/react-dom/src/__tests__/ReactUpdates-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,7 @@ describe('ReactUpdates', () => {
15421542
}
15431543
}
15441544

1545-
let limit = 105;
1545+
let limit = 55;
15461546
const root = ReactDOMClient.createRoot(container);
15471547
await expect(async () => {
15481548
await act(() => {

packages/react-reconciler/src/ReactFiberWorkLoop.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,13 @@ let pendingPassiveEffectsRenderEndTime: number = -0; // Profiling-only
608608
let pendingPassiveTransitions: Array<Transition> | null = null;
609609

610610
// Use these to prevent an infinite loop of nested updates
611-
const NESTED_UPDATE_LIMIT = 100;
611+
const NESTED_UPDATE_LIMIT = 50;
612612
let nestedUpdateCount: number = 0;
613613
let rootWithNestedUpdates: FiberRoot | null = null;
614614
let isFlushingPassiveEffects = false;
615615
let didScheduleUpdateDuringPassiveEffects = false;
616616

617-
const NESTED_PASSIVE_UPDATE_LIMIT = 100;
617+
const NESTED_PASSIVE_UPDATE_LIMIT = 50;
618618
let nestedPassiveUpdateCount: number = 0;
619619
let rootWithPassiveNestedUpdates: FiberRoot | null = null;
620620

packages/shared/ReactFeatureFlags.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ export const retryLaneExpirationMs = 5000;
157157
export const syncLaneExpirationMs = 250;
158158
export const transitionLaneExpirationMs = 5000;
159159

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+
160166
// -----------------------------------------------------------------------------
161167
// Ready for next major.
162168
//
@@ -204,12 +210,6 @@ export const enableFilterEmptyStringAttributesDOM = true;
204210
// Disabled caching behavior of `react/cache` in client runtimes.
205211
export const disableClientCache = true;
206212

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-
213213
// Subtle breaking changes to JSX runtime to make it faster, like passing `ref`
214214
// as a normal prop instead of stripping it from the props object.
215215

packages/shared/forks/ReactFeatureFlags.native-fb.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const enableFizzExternalRuntime = true;
6060
export const enableFlightReadableStream = true;
6161
export const enableGetInspectorDataForInstanceInProduction = true;
6262
export const enableHalt = false;
63-
export const enableInfiniteRenderLoopDetection = true;
63+
export const enableInfiniteRenderLoopDetection = false;
6464
export const enableContextProfiling = false;
6565
export const enableLazyContextPropagation = true;
6666
export const enableLegacyCache = false;

packages/shared/forks/ReactFeatureFlags.native-oss.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const enableFlightReadableStream = true;
5151
export const enableGetInspectorDataForInstanceInProduction = false;
5252
export const enableHalt = false;
5353
export const enableHiddenSubtreeInsertionEffectCleanup = false;
54-
export const enableInfiniteRenderLoopDetection = true;
54+
export const enableInfiniteRenderLoopDetection = false;
5555
export const enableLazyContextPropagation = true;
5656
export const enableContextProfiling = false;
5757
export const enableLegacyCache = false;

packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const enableFizzExternalRuntime = true;
4141
export const enableFlightReadableStream = true;
4242
export const enableGetInspectorDataForInstanceInProduction = false;
4343
export const enableHalt = false;
44-
export const enableInfiniteRenderLoopDetection = true;
44+
export const enableInfiniteRenderLoopDetection = false;
4545
export const enableLazyContextPropagation = true;
4646
export const enableContextProfiling = false;
4747
export const enableHiddenSubtreeInsertionEffectCleanup = true;

0 commit comments

Comments
 (0)