Skip to content

Commit 419ccc2

Browse files
authored
Land skipUnmountedBoundaries experiment (#23322)
This has been rolled out to 10% of Facebook users for months without any issues.
1 parent 54f785b commit 419ccc2

15 files changed

+4
-50
lines changed

packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ describe('ReactErrorBoundaries', () => {
4242
PropTypes = require('prop-types');
4343
ReactFeatureFlags = require('shared/ReactFeatureFlags');
4444
ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false;
45-
ReactFeatureFlags.skipUnmountedBoundaries = true;
4645
ReactDOM = require('react-dom');
4746
React = require('react');
4847
act = require('jest-react').act;

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
enableSchedulingProfiler,
3131
disableSchedulerTimeoutInWorkLoop,
3232
enableStrictEffects,
33-
skipUnmountedBoundaries,
3433
enableUpdaterTracking,
3534
warnOnSubscriptionInsideStartTransition,
3635
enableCache,
@@ -2445,13 +2444,7 @@ export function captureCommitPhaseError(
24452444
return;
24462445
}
24472446

2448-
let fiber = null;
2449-
if (skipUnmountedBoundaries) {
2450-
fiber = nearestMountedAncestor;
2451-
} else {
2452-
fiber = sourceFiber.return;
2453-
}
2454-
2447+
let fiber = nearestMountedAncestor;
24552448
while (fiber !== null) {
24562449
if (fiber.tag === HostRoot) {
24572450
captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
@@ -2484,14 +2477,9 @@ export function captureCommitPhaseError(
24842477
}
24852478

24862479
if (__DEV__) {
2487-
// TODO: Until we re-land skipUnmountedBoundaries (see #20147), this warning
2488-
// will fire for errors that are thrown by destroy functions inside deleted
2489-
// trees. What it should instead do is propagate the error to the parent of
2490-
// the deleted tree. In the meantime, do not add this warning to the
2491-
// allowlist; this is only for our internal use.
24922480
console.error(
24932481
'Internal React error: Attempted to capture a commit phase error ' +
2494-
'inside a detached tree. This indicates a bug in React. Likely ' +
2482+
'inside a detached tree. This indicates a bug in React. Potential ' +
24952483
'causes include deleting the same fiber more than once, committing an ' +
24962484
'already-finished tree, or an inconsistent return pointer.\n\n' +
24972485
'Error message:\n\n%s',

packages/react-reconciler/src/ReactFiberWorkLoop.old.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
enableSchedulingProfiler,
3131
disableSchedulerTimeoutInWorkLoop,
3232
enableStrictEffects,
33-
skipUnmountedBoundaries,
3433
enableUpdaterTracking,
3534
warnOnSubscriptionInsideStartTransition,
3635
enableCache,
@@ -2445,13 +2444,7 @@ export function captureCommitPhaseError(
24452444
return;
24462445
}
24472446

2448-
let fiber = null;
2449-
if (skipUnmountedBoundaries) {
2450-
fiber = nearestMountedAncestor;
2451-
} else {
2452-
fiber = sourceFiber.return;
2453-
}
2454-
2447+
let fiber = nearestMountedAncestor;
24552448
while (fiber !== null) {
24562449
if (fiber.tag === HostRoot) {
24572450
captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
@@ -2484,14 +2477,9 @@ export function captureCommitPhaseError(
24842477
}
24852478

24862479
if (__DEV__) {
2487-
// TODO: Until we re-land skipUnmountedBoundaries (see #20147), this warning
2488-
// will fire for errors that are thrown by destroy functions inside deleted
2489-
// trees. What it should instead do is propagate the error to the parent of
2490-
// the deleted tree. In the meantime, do not add this warning to the
2491-
// allowlist; this is only for our internal use.
24922480
console.error(
24932481
'Internal React error: Attempted to capture a commit phase error ' +
2494-
'inside a detached tree. This indicates a bug in React. Likely ' +
2482+
'inside a detached tree. This indicates a bug in React. Potential ' +
24952483
'causes include deleting the same fiber more than once, committing an ' +
24962484
'already-finished tree, or an inconsistent return pointer.\n\n' +
24972485
'Error message:\n\n%s',

packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,7 +2351,6 @@ describe('ReactHooksWithNoopRenderer', () => {
23512351
};
23522352
});
23532353

2354-
// @gate skipUnmountedBoundaries
23552354
it('should use the nearest still-mounted boundary if there are no unmounted boundaries', () => {
23562355
act(() => {
23572356
ReactNoop.render(
@@ -2377,7 +2376,6 @@ describe('ReactHooksWithNoopRenderer', () => {
23772376
]);
23782377
});
23792378

2380-
// @gate skipUnmountedBoundaries
23812379
it('should skip unmounted boundaries and use the nearest still-mounted boundary', () => {
23822380
function Conditional({showChildren}) {
23832381
if (showChildren) {
@@ -2420,7 +2418,6 @@ describe('ReactHooksWithNoopRenderer', () => {
24202418
]);
24212419
});
24222420

2423-
// @gate skipUnmountedBoundaries
24242421
it('should call getDerivedStateFromError in the nearest still-mounted boundary', () => {
24252422
function Conditional({showChildren}) {
24262423
if (showChildren) {
@@ -2464,7 +2461,6 @@ describe('ReactHooksWithNoopRenderer', () => {
24642461
]);
24652462
});
24662463

2467-
// @gate skipUnmountedBoundaries
24682464
it('should rethrow error if there are no still-mounted boundaries', () => {
24692465
function Conditional({showChildren}) {
24702466
if (showChildren) {
@@ -3190,7 +3186,6 @@ describe('ReactHooksWithNoopRenderer', () => {
31903186
]);
31913187
});
31923188

3193-
// @gate skipUnmountedBoundaries
31943189
it('catches errors thrown in useLayoutEffect', () => {
31953190
class ErrorBoundary extends React.Component {
31963191
state = {error: null};

packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,6 @@ describe('ReactIncrementalErrorHandling', () => {
10171017
expect(Scheduler).toFlushAndYield(['Foo']);
10181018
});
10191019

1020-
// @gate skipUnmountedBoundaries
10211020
it('should not attempt to recover an unmounting error boundary', () => {
10221021
class Parent extends React.Component {
10231022
componentWillUnmount() {

packages/shared/ReactFeatureFlags.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,6 @@ export const disableNativeComponentFrames = false;
121121
// Internal only.
122122
export const enableGetInspectorDataForInstanceInProduction = false;
123123

124-
// Errors that are thrown while unmounting (or after in the case of passive effects)
125-
// should bypass any error boundaries that are also unmounting (or have unmounted)
126-
// and be handled by the nearest still-mounted boundary.
127-
// If there are no still-mounted boundaries, the errors should be rethrown.
128-
export const skipUnmountedBoundaries = false;
129-
130124
// When a node is unmounted, recurse into the Fiber subtree and clean out
131125
// references. Each level cleans up more fiber fields than the previous level.
132126
// As far as we know, React itself doesn't leak, but because the Fiber contains

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ export const enableComponentStackLocations = false;
5858
export const enableLegacyFBSupport = false;
5959
export const enableFilterEmptyStringAttributesDOM = false;
6060
export const disableNativeComponentFrames = false;
61-
export const skipUnmountedBoundaries = false;
6261
export const deletedTreeCleanUpLevel = 3;
6362
export const enableSuspenseLayoutEffectSemantics = false;
6463
export const enableGetInspectorDataForInstanceInProduction = true;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const enableComponentStackLocations = false;
4949
export const enableLegacyFBSupport = false;
5050
export const enableFilterEmptyStringAttributesDOM = false;
5151
export const disableNativeComponentFrames = false;
52-
export const skipUnmountedBoundaries = false;
5352
export const deletedTreeCleanUpLevel = 3;
5453
export const enableSuspenseLayoutEffectSemantics = false;
5554
export const enableGetInspectorDataForInstanceInProduction = false;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const enableComponentStackLocations = true;
4949
export const enableLegacyFBSupport = false;
5050
export const enableFilterEmptyStringAttributesDOM = false;
5151
export const disableNativeComponentFrames = false;
52-
export const skipUnmountedBoundaries = false;
5352
export const deletedTreeCleanUpLevel = 3;
5453
export const enableSuspenseLayoutEffectSemantics = false;
5554
export const enableGetInspectorDataForInstanceInProduction = false;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export const enableComponentStackLocations = false;
4444
export const enableLegacyFBSupport = false;
4545
export const enableFilterEmptyStringAttributesDOM = false;
4646
export const disableNativeComponentFrames = false;
47-
export const skipUnmountedBoundaries = false;
4847
export const deletedTreeCleanUpLevel = 3;
4948
export const enableSuspenseLayoutEffectSemantics = false;
5049
export const enableGetInspectorDataForInstanceInProduction = false;

packages/shared/forks/ReactFeatureFlags.test-renderer.www.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const enableComponentStackLocations = true;
4949
export const enableLegacyFBSupport = false;
5050
export const enableFilterEmptyStringAttributesDOM = false;
5151
export const disableNativeComponentFrames = false;
52-
export const skipUnmountedBoundaries = false;
5352
export const deletedTreeCleanUpLevel = 3;
5453
export const enableSuspenseLayoutEffectSemantics = false;
5554
export const enableGetInspectorDataForInstanceInProduction = false;

packages/shared/forks/ReactFeatureFlags.testing.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const enableComponentStackLocations = true;
4949
export const enableLegacyFBSupport = false;
5050
export const enableFilterEmptyStringAttributesDOM = false;
5151
export const disableNativeComponentFrames = false;
52-
export const skipUnmountedBoundaries = false;
5352
export const deletedTreeCleanUpLevel = 3;
5453
export const enableSuspenseLayoutEffectSemantics = false;
5554
export const enableGetInspectorDataForInstanceInProduction = false;

packages/shared/forks/ReactFeatureFlags.testing.www.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const enableComponentStackLocations = true;
4949
export const enableLegacyFBSupport = !__EXPERIMENTAL__;
5050
export const enableFilterEmptyStringAttributesDOM = false;
5151
export const disableNativeComponentFrames = false;
52-
export const skipUnmountedBoundaries = true;
5352
export const deletedTreeCleanUpLevel = 3;
5453
export const enableSuspenseLayoutEffectSemantics = false;
5554
export const enableGetInspectorDataForInstanceInProduction = false;

packages/shared/forks/ReactFeatureFlags.www-dynamic.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export const warnAboutSpreadingKeyToJSX = __VARIANT__;
1717
export const disableInputAttributeSyncing = __VARIANT__;
1818
export const enableFilterEmptyStringAttributesDOM = __VARIANT__;
1919
export const enableLegacyFBSupport = __VARIANT__;
20-
export const skipUnmountedBoundaries = __VARIANT__;
2120
export const enableUseRefAccessWarning = __VARIANT__;
2221
export const deletedTreeCleanUpLevel = __VARIANT__ ? 3 : 1;
2322
export const enableProfilerNestedUpdateScheduledHook = __VARIANT__;

packages/shared/forks/ReactFeatureFlags.www.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export const {
2424
enableLegacyFBSupport,
2525
deferRenderPhaseUpdateToNextBatch,
2626
enableDebugTracing,
27-
skipUnmountedBoundaries,
2827
createRootStrictEffectsByDefault,
2928
enableUseRefAccessWarning,
3029
disableNativeComponentFrames,

0 commit comments

Comments
 (0)