Skip to content

Commit e0cc720

Browse files
authored
[flags] Clean up enableHiddenSubtreeInsertionEffectCleanup (facebook#35918)
Been enabled in stable for quite a while, also rolled out at Meta.
1 parent 843d69f commit e0cc720

13 files changed

+17
-53
lines changed

packages/react-reconciler/src/ReactFiberCommitWork.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import {
4848
alwaysThrottleRetries,
4949
enableCreateEventHandleAPI,
5050
enableEffectEventMutationPhase,
51-
enableHiddenSubtreeInsertionEffectCleanup,
5251
enableProfilerTimer,
5352
enableProfilerCommitHooks,
5453
enableSuspenseCallback,
@@ -1663,17 +1662,12 @@ function commitDeletionEffectsOnFiber(
16631662
case ForwardRef:
16641663
case MemoComponent:
16651664
case SimpleMemoComponent: {
1666-
if (
1667-
enableHiddenSubtreeInsertionEffectCleanup ||
1668-
!offscreenSubtreeWasHidden
1669-
) {
1670-
// TODO: Use a commitHookInsertionUnmountEffects wrapper to record timings.
1671-
commitHookEffectListUnmount(
1672-
HookInsertion,
1673-
deletedFiber,
1674-
nearestMountedAncestor,
1675-
);
1676-
}
1665+
// TODO: Use a commitHookInsertionUnmountEffects wrapper to record timings.
1666+
commitHookEffectListUnmount(
1667+
HookInsertion,
1668+
deletedFiber,
1669+
nearestMountedAncestor,
1670+
);
16771671
if (!offscreenSubtreeWasHidden) {
16781672
commitHookLayoutUnmountEffects(
16791673
deletedFiber,

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3070,14 +3070,10 @@ describe('ReactHooksWithNoopRenderer', () => {
30703070
await act(() => {
30713071
root.render(<Activity mode="hidden" />);
30723072
});
3073-
assertConsoleErrorDev(
3074-
gate('enableHiddenSubtreeInsertionEffectCleanup')
3075-
? [
3076-
'useInsertionEffect must not schedule updates.\n' +
3077-
' in App (at **)',
3078-
]
3079-
: [],
3080-
);
3073+
assertConsoleErrorDev([
3074+
'useInsertionEffect must not schedule updates.\n' +
3075+
' in App (at **)',
3076+
]);
30813077

30823078
// Should not warn for regular effects after throw.
30833079
function NotInsertion() {

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,9 +1610,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
16101610
'AsyncText:InnerAsync_1 render',
16111611
'Text:OuterFallback destroy insertion',
16121612
'Text:OuterFallback destroy layout',
1613-
...(gate(flags => flags.enableHiddenSubtreeInsertionEffectCleanup)
1614-
? ['Text:InnerFallback destroy insertion']
1615-
: []),
1613+
'Text:InnerFallback destroy insertion',
16161614
'Text:Outer create layout',
16171615
'AsyncText:OuterAsync_1 create layout',
16181616
'Text:Inner create layout',
@@ -1757,9 +1755,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
17571755
assertLog([
17581756
'Text:Inside render',
17591757
'AsyncText:OutsideAsync render',
1760-
...(gate(flags => flags.enableHiddenSubtreeInsertionEffectCleanup)
1761-
? ['Text:Fallback:Inside destroy insertion']
1762-
: []),
1758+
'Text:Fallback:Inside destroy insertion',
17631759
'Text:Fallback:Fallback destroy insertion',
17641760
'Text:Fallback:Fallback destroy layout',
17651761
'Text:Fallback:Outside destroy insertion',
@@ -2248,9 +2244,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
22482244

22492245
// Destroy layout and passive effects in the errored tree.
22502246
'App destroy layout',
2251-
...(gate(flags => flags.enableHiddenSubtreeInsertionEffectCleanup)
2252-
? ['Text:Inside destroy insertion']
2253-
: []),
2247+
'Text:Inside destroy insertion',
22542248
'Text:Fallback destroy insertion',
22552249
'Text:Fallback destroy layout',
22562250
'Text:Outside destroy insertion',
@@ -2511,9 +2505,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
25112505

25122506
// Destroy layout and passive effects in the errored tree.
25132507
'App destroy layout',
2514-
...(gate(flags => flags.enableHiddenSubtreeInsertionEffectCleanup)
2515-
? ['Text:Inside destroy insertion']
2516-
: []),
2508+
'Text:Inside destroy insertion',
25172509
'Text:Fallback destroy insertion',
25182510
'Text:Fallback destroy layout',
25192511
'Text:Outside destroy insertion',

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -938,14 +938,9 @@ describe('useEffectEvent', () => {
938938
assertLog([
939939
'Parent Insertion Create: A 3 2',
940940
'Parent Layout Cleanup: A 3 2',
941-
...(gate('enableHiddenSubtreeInsertionEffectCleanup')
942-
? [
943-
gate('enableViewTransition') &&
944-
!gate('enableEffectEventMutationPhase')
945-
? 'Child Insertion Destroy A 3 2 B 1 1 1'
946-
: 'Child Insertion Destroy A 3 2 B 3 2 2',
947-
]
948-
: []),
941+
gate('enableViewTransition') && !gate('enableEffectEventMutationPhase')
942+
? 'Child Insertion Destroy A 3 2 B 1 1 1'
943+
: 'Child Insertion Destroy A 3 2 B 3 2 2',
949944
]);
950945
});
951946

packages/shared/ReactFeatureFlags.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,6 @@ export const enableInternalInstanceMap: boolean = false;
162162

163163
// const __NEXT_MAJOR__ = __EXPERIMENTAL__;
164164

165-
/**
166-
* Enables a fix to run insertion effect cleanup on hidden subtrees.
167-
*/
168-
export const enableHiddenSubtreeInsertionEffectCleanup: boolean = true;
169-
170165
/**
171166
* Removes legacy style context defined using static `contextTypes` and consumed with static `childContextTypes`.
172167
*/

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
export const alwaysThrottleRetries = __VARIANT__;
2121
export const enableObjectFiber = __VARIANT__;
22-
export const enableHiddenSubtreeInsertionEffectCleanup = __VARIANT__;
2322
export const enableEagerAlternateStateNodeCleanup = __VARIANT__;
2423
export const passChildrenWhenCloningPersistedNodes = __VARIANT__;
2524
export const enableFragmentRefs = __VARIANT__;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const dynamicFlags: DynamicExportsType = (dynamicFlagsUntyped: any);
2121
export const {
2222
alwaysThrottleRetries,
2323
enableEffectEventMutationPhase,
24-
enableHiddenSubtreeInsertionEffectCleanup,
2524
enableObjectFiber,
2625
enableEagerAlternateStateNodeCleanup,
2726
passChildrenWhenCloningPersistedNodes,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export const enableCPUSuspense: boolean = false;
3030
export const enableCreateEventHandleAPI: boolean = false;
3131
export const enableMoveBefore: boolean = true;
3232
export const enableFizzExternalRuntime: boolean = true;
33-
export const enableHiddenSubtreeInsertionEffectCleanup: boolean = false;
3433
export const enableInfiniteRenderLoopDetection: boolean = false;
3534
export const enableLegacyCache: boolean = false;
3635
export const enableLegacyFBSupport: boolean = false;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export const enableCPUSuspense: boolean = false;
3333
export const enableNoCloningMemoCache: boolean = false;
3434
export const enableLegacyFBSupport: boolean = false;
3535
export const enableMoveBefore: boolean = false;
36-
export const enableHiddenSubtreeInsertionEffectCleanup: boolean = false;
3736

3837
export const enableRetryLaneExpiration: boolean = false;
3938
export const retryLaneExpirationMs = 5000;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const enableCreateEventHandleAPI = false;
2626
export const enableMoveBefore = false;
2727
export const enableFizzExternalRuntime = true;
2828
export const enableInfiniteRenderLoopDetection = false;
29-
export const enableHiddenSubtreeInsertionEffectCleanup = true;
3029
export const enableLegacyCache = false;
3130
export const enableLegacyFBSupport = false;
3231
export const enableLegacyHidden = false;

0 commit comments

Comments
 (0)