Remove skipUnmountedBoundaries (#26489)
# Overview Landing this flag internally, will test this PR in React Native before merging.
Ricky committed
Mar 30, 2023 at 20:58 UTC
ca01f359b9236292c749075bb2fd41bb7b569308
12 files changed
+2
-36
packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js
-1
@@ -43,7 +43,6 @@ describe('ReactErrorBoundaries', () => {
43
PropTypes = require('prop-types');
44
ReactFeatureFlags = require('shared/ReactFeatureFlags');
45
ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false;
46
- ReactFeatureFlags.skipUnmountedBoundaries = true;
46
ReactDOM = require('react-dom');
47
React = require('react');
48
act = require('internal-test-utils').act;
packages/react-reconciler/src/ReactFiberWorkLoop.js
+2
-14
@@ -33,7 +33,6 @@ import {
33
enableDebugTracing,
34
enableSchedulingProfiler,
35
disableSchedulerTimeoutInWorkLoop,
36
- skipUnmountedBoundaries,
36
enableUpdaterTracking,
37
enableCache,
38
enableTransitionTracing,
@@ -3517,13 +3516,7 @@ export function captureCommitPhaseError(
3516
return;
3517
}
3518
3520
- let fiber = null;
3521
- if (skipUnmountedBoundaries) {
3522
- fiber = nearestMountedAncestor;
3523
- } else {
3524
- fiber = sourceFiber.return;
3525
- }
3526
-
3519
+ let fiber = nearestMountedAncestor;
3520
while (fiber !== null) {
3521
if (fiber.tag === HostRoot) {
3522
captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
@@ -3555,14 +3548,9 @@ export function captureCommitPhaseError(
3548
}
3549
3550
if (__DEV__) {
3558
- // TODO: Until we re-land skipUnmountedBoundaries (see #20147), this warning
3559
- // will fire for errors that are thrown by destroy functions inside deleted
3560
- // trees. What it should instead do is propagate the error to the parent of
3561
- // the deleted tree. In the meantime, do not add this warning to the
3562
- // allowlist; this is only for our internal use.
3551
console.error(
3552
'Internal React error: Attempted to capture a commit phase error ' +
3565
- 'inside a detached tree. This indicates a bug in React. Likely ' +
3553
+ 'inside a detached tree. This indicates a bug in React. Potential ' +
3554
'causes include deleting the same fiber more than once, committing an ' +
3555
'already-finished tree, or an inconsistent return pointer.\n\n' +
3556
'Error message:\n\n%s',
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
-9
@@ -2254,7 +2254,6 @@ describe('ReactHooksWithNoopRenderer', () => {
2254
};
2255
});
2256
2257
- // @gate skipUnmountedBoundaries
2257
it('should use the nearest still-mounted boundary if there are no unmounted boundaries', async () => {
2258
await act(() => {
2259
ReactNoop.render(
@@ -2280,7 +2279,6 @@ describe('ReactHooksWithNoopRenderer', () => {
2279
]);
2280
});
2281
2283
- // @gate skipUnmountedBoundaries
2282
it('should skip unmounted boundaries and use the nearest still-mounted boundary', async () => {
2283
function Conditional({showChildren}) {
2284
if (showChildren) {
@@ -2323,7 +2321,6 @@ describe('ReactHooksWithNoopRenderer', () => {
2321
]);
2322
});
2323
2326
- // @gate skipUnmountedBoundaries
2324
it('should call getDerivedStateFromError in the nearest still-mounted boundary', async () => {
2325
function Conditional({showChildren}) {
2326
if (showChildren) {
@@ -2367,7 +2364,6 @@ describe('ReactHooksWithNoopRenderer', () => {
2364
);
2365
});
2366
2370
- // @gate skipUnmountedBoundaries
2367
it('should rethrow error if there are no still-mounted boundaries', async () => {
2368
function Conditional({showChildren}) {
2369
if (showChildren) {
@@ -2531,10 +2527,6 @@ describe('ReactHooksWithNoopRenderer', () => {
2527
assertLog(['layout destroy', 'passive destroy']);
2528
});
2529
2534
- // TODO: This test fails when skipUnmountedBoundaries is disabled. However,
2535
- // it's also rolled out to open source already and partially to www. So
2536
- // we should probably just land it.
2537
- // @gate skipUnmountedBoundaries
2530
it('assumes passive effect destroy function is either a function or undefined', async () => {
2531
function App(props) {
2532
useEffect(() => {
@@ -3117,7 +3109,6 @@ describe('ReactHooksWithNoopRenderer', () => {
3109
assertLog(['Unmount normal [current: 1]', 'Mount normal [current: 1]']);
3110
});
3111
3120
- // @gate skipUnmountedBoundaries
3112
it('catches errors thrown in useLayoutEffect', async () => {
3113
class ErrorBoundary extends React.Component {
3114
state = {error: null};
packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js
-1
@@ -962,7 +962,6 @@ describe('ReactIncrementalErrorHandling', () => {
962
await waitForAll(['Foo']);
963
});
964
965
- // @gate skipUnmountedBoundaries
965
it('should not attempt to recover an unmounting error boundary', async () => {
966
class Parent extends React.Component {
967
componentWillUnmount() {
packages/shared/ReactFeatureFlags.js
-4
@@ -34,10 +34,6 @@ export const revertRemovalOfSiblingPrerendering = false;
34
// like migrating internal callers or performance testing.
35
// -----------------------------------------------------------------------------
36
37
-// This rolled out to 10% public in www, so we should be able to land, but some
38
-// internal tests need to be updated. The open source behavior is correct.
39
-export const skipUnmountedBoundaries = true;
40
-
37
// TODO: Finish rolling out in www
38
export const enableClientRenderFallbackOnTextMismatch = true;
39
packages/shared/forks/ReactFeatureFlags.native-fb.js
-1
@@ -58,7 +58,6 @@ export const enableClientRenderFallbackOnTextMismatch = true;
58
export const enableComponentStackLocations = false;
59
export const enableLegacyFBSupport = false;
60
export const enableFilterEmptyStringAttributesDOM = false;
61
-export const skipUnmountedBoundaries = false;
61
export const enableGetInspectorDataForInstanceInProduction = true;
62
63
export const createRootStrictEffectsByDefault = false;
packages/shared/forks/ReactFeatureFlags.native-oss.js
-1
@@ -48,7 +48,6 @@ export const enableClientRenderFallbackOnTextMismatch = true;
48
export const enableComponentStackLocations = false;
49
export const enableLegacyFBSupport = false;
50
export const enableFilterEmptyStringAttributesDOM = false;
51
-export const skipUnmountedBoundaries = false;
51
export const enableGetInspectorDataForInstanceInProduction = false;
52
53
export const createRootStrictEffectsByDefault = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.js
-1
@@ -48,7 +48,6 @@ export const enableClientRenderFallbackOnTextMismatch = true;
48
export const enableComponentStackLocations = true;
49
export const enableLegacyFBSupport = false;
50
export const enableFilterEmptyStringAttributesDOM = false;
51
-export const skipUnmountedBoundaries = false;
51
export const enableGetInspectorDataForInstanceInProduction = false;
52
53
export const createRootStrictEffectsByDefault = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.native.js
-1
@@ -39,7 +39,6 @@ export const disableModulePatternComponents = false;
39
export const enableComponentStackLocations = false;
40
export const enableLegacyFBSupport = false;
41
export const enableFilterEmptyStringAttributesDOM = false;
42
-export const skipUnmountedBoundaries = false;
42
export const enableGetInspectorDataForInstanceInProduction = false;
43
export const enableSuspenseAvoidThisFallback = false;
44
export const enableSuspenseAvoidThisFallbackFizz = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
-1
@@ -48,7 +48,6 @@ export const enableClientRenderFallbackOnTextMismatch = true;
48
export const enableComponentStackLocations = true;
49
export const enableLegacyFBSupport = false;
50
export const enableFilterEmptyStringAttributesDOM = true;
51
-export const skipUnmountedBoundaries = false;
51
export const enableGetInspectorDataForInstanceInProduction = false;
52
53
export const createRootStrictEffectsByDefault = false;
packages/shared/forks/ReactFeatureFlags.www-dynamic.js
-1
@@ -16,7 +16,6 @@
16
export const disableInputAttributeSyncing = __VARIANT__;
17
export const disableIEWorkarounds = __VARIANT__;
18
export const enableLegacyFBSupport = __VARIANT__;
19
-export const skipUnmountedBoundaries = __VARIANT__;
19
export const enableUseRefAccessWarning = __VARIANT__;
20
export const enableProfilerNestedUpdateScheduledHook = __VARIANT__;
21
export const disableSchedulerTimeoutInWorkLoop = __VARIANT__;
packages/shared/forks/ReactFeatureFlags.www.js
-1
@@ -22,7 +22,6 @@ export const {
22
replayFailedUnitOfWorkWithInvokeGuardedCallback,
23
enableLegacyFBSupport,
24
enableDebugTracing,
25
- skipUnmountedBoundaries,
25
enableUseRefAccessWarning,
26
enableLazyContextPropagation,
27
enableUnifiedSyncLane,