@samitouri / QOS-React / commits / ea5bc6bac1

[React Native FB] dynamic feature flag for ref access warning (#25471)

Jan Kassens committed Oct 14, 2022 at 10:11 UTC ea5bc6bac122ac9e0b45b5200f1456d47801fa18
3 files changed +9 -9
packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js
+6 -6
@@ -7,10 +7,8 @@
7 * @flow strict
8 */
9
10 -// NOTE: There are no flags, currently. Uncomment the stuff below if we add one.
11 -
12 -// import typeof * as ExportsType from './ReactFeatureFlags.native-fb-dynamic';
13 -// import typeof * as DynamicFlagsType from 'ReactNativeInternalFeatureFlags';
10 +import typeof * as ExportsType from './ReactFeatureFlags.native-fb-dynamic';
11 +import typeof * as DynamicFlagsType from 'ReactNativeInternalFeatureFlags';
12
13 // In xplat, these flags are controlled by GKs. Because most GKs have some
14 // population running in either mode, we should run our tests that way, too,
@@ -22,5 +20,7 @@
20 // flag here but it won't be set to `true` in any of our test runs. Need to
21 // update the test configuration.
22
25 -// // Flow magic to verify the exports of this file match the original version.
26 -// ((((null: any): ExportsType): FeatureFlagsType): ExportsType);
23 +export const enableUseRefAccessWarning = __VARIANT__;
24 +
25 +// Flow magic to verify the exports of this file match the original version.
26 +((((null: any): ExportsType): DynamicFlagsType): ExportsType);
packages/shared/forks/ReactFeatureFlags.native-fb.js
+2 -3
@@ -13,11 +13,11 @@ import typeof * as ExportsType from './ReactFeatureFlags.native-fb';
13 // NOTE: There are no flags, currently. Uncomment the stuff below if we add one.
14 // Re-export dynamic flags from the internal module. Intentionally using *
15 // because this import is compiled to a `require` call.
16 -// import * as dynamicFlags from 'ReactNativeInternalFeatureFlags';
16 +import * as dynamicFlags from 'ReactNativeInternalFeatureFlags';
17
18 // We destructure each value before re-exporting to avoid a dynamic look-up on
19 // the exports object every time a flag is read.
20 -// export const {} = dynamicFlags;
20 +export const {enableUseRefAccessWarning} = dynamicFlags;
21
22 // The rest of the flags are static for better dead code elimination.
23 export const enableDebugTracing = false;
@@ -67,7 +67,6 @@ export const deferRenderPhaseUpdateToNextBatch = false;
67
68 export const enableStrictEffects = __DEV__;
69 export const createRootStrictEffectsByDefault = false;
70 -export const enableUseRefAccessWarning = false;
70
71 export const disableSchedulerTimeoutInWorkLoop = false;
72 export const enableLazyContextPropagation = false;
scripts/flow/xplat.js
+1
@@ -8,4 +8,5 @@
8 */
9
10 declare module 'ReactNativeInternalFeatureFlags' {
11 + declare export var enableUseRefAccessWarning: boolean;
12 }