Skip to content

Commit f99c9fe

Browse files
authored
Fix ownerStackLimit feature gating for tests (#32726)
#32529 added a dynamic flag for this, but that breaks tests since the flags are not defined everywhere. However, this is a static value and the flag is only for supporting existing tests. So we can override it in the test config, and make it static at built time instead.
1 parent 8ac25e5 commit f99c9fe

6 files changed

+9
-11
lines changed

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

-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,3 @@ export const enableUseEffectCRUDOverload = __VARIANT__;
2929
export const enableFastAddPropertiesInDiffing = __VARIANT__;
3030
export const enableLazyPublicInstanceInFabric = __VARIANT__;
3131
export const renameElementSymbol = __VARIANT__;
32-
export const ownerStackLimit: number = __VARIANT__
33-
? // Some value that doesn't impact existing tests
34-
500
35-
: 1e4;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export const {
3131
enableFastAddPropertiesInDiffing,
3232
enableLazyPublicInstanceInFabric,
3333
renameElementSymbol,
34-
ownerStackLimit,
3534
} = dynamicFlags;
3635

3736
// The rest of the flags are static for better dead code elimination.
@@ -85,6 +84,7 @@ export const enableViewTransition = false;
8584
export const enableSwipeTransition = false;
8685
export const enableScrollEndPolyfill = true;
8786
export const enableFragmentRefs = false;
87+
export const ownerStackLimit = 1e4;
8888

8989
// Flow magic to verify the exports of this file match the original version.
9090
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

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

-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ export const enableComponentPerformanceTrack = __VARIANT__;
4343
export const enableScrollEndPolyfill = __VARIANT__;
4444
export const enableFragmentRefs = __VARIANT__;
4545

46-
export const ownerStackLimit: number = __VARIANT__
47-
? // Some value that doesn't impact existing tests
48-
500
49-
: 1e4;
50-
5146
// TODO: These flags are hard-coded to the default values used in open source.
5247
// Update the tests so that they pass in either mode, then set these
5348
// to __VARIANT__.

packages/shared/forks/ReactFeatureFlags.www.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export const {
4040
enableComponentPerformanceTrack,
4141
enableScrollEndPolyfill,
4242
enableFragmentRefs,
43-
ownerStackLimit,
4443
} = dynamicFeatureFlags;
4544

4645
// On WWW, __EXPERIMENTAL__ is used for a new modern build.
@@ -115,5 +114,7 @@ export const enableLazyPublicInstanceInFabric = false;
115114

116115
export const enableSwipeTransition = false;
117116

117+
export const ownerStackLimit = 1e4;
118+
118119
// Flow magic to verify the exports of this file match the original version.
119120
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

scripts/jest/setupTests.www.js

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jest.mock('shared/ReactFeatureFlags', () => {
1717
// we remove the flag.
1818
actual.disableClientCache = __VARIANT__;
1919

20+
// Some value that doesn't impact existing tests
21+
actual.ownerStackLimit = __VARIANT__ ? 500 : 1e4;
22+
2023
return actual;
2124
});
2225

scripts/jest/setupTests.xplat.js

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jest.mock('shared/ReactFeatureFlags', () => {
2222
actual.enableScopeAPI = true;
2323
actual.enableTaint = false;
2424

25+
// Some value that doesn't impact existing tests
26+
actual.ownerStackLimit = __VARIANT__ ? 500 : 1e4;
27+
2528
return actual;
2629
});
2730

0 commit comments

Comments
 (0)