@samitouri / QOS-React-2 / commits / 96914c98df

Split static and dynamic www feature flags (#11471)

Dan Abramov committed Nov 6, 2017 at 16:17 UTC 96914c98dfbe684afcbc3285ca31736451e533fe
1 file changed +20 -8
scripts/rollup/shims/rollup/ReactFeatureFlags-www.js
+20 -8
@@ -10,18 +10,27 @@
10 import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
11 import typeof * as FeatureFlagsShimType from './ReactFeatureFlags-www';
12
13 -// Re-export all flags from the www version.
13 +// Re-export dynamic flags from the www version.
14 export const {
15 - enableAsyncSubtreeAPI,
15 enableAsyncSchedulingByDefaultInReactDOM,
17 - enableReactFragment,
18 - enableCreateRoot,
19 - // Reconciler flags
20 - enableMutatingReconciler,
21 - enableNoopReconciler,
22 - enablePersistentReconciler,
16 } = require('ReactFeatureFlags');
17
18 +// The rest of the flags are static for better dead code elimination.
19 +export const enableAsyncSubtreeAPI = true;
20 +export const enableReactFragment = false;
21 +export const enableCreateRoot = false;
22 +
23 +// The www bundles only use the mutating reconciler.
24 +export const enableMutatingReconciler = true;
25 +export const enableNoopReconciler = false;
26 +export const enablePersistentReconciler = false;
27 +
28 +// In www, we have experimental support for gathering data
29 +// from User Timing API calls in production. By default, we
30 +// only emit performance.mark/measure calls in __DEV__. But if
31 +// somebody calls addUserTimingListener() which is exposed as an
32 +// experimental FB-only export, we call performance.mark/measure
33 +// as long as there is more than a single listener.
34 export let enableUserTimingAPI = __DEV__;
35
36 let refCount = 0;
@@ -38,6 +47,9 @@ export function addUserTimingListener() {
47 };
48 }
49
50 +// The flag is intentionally updated in a timeout.
51 +// We don't support toggling it during reconciliation or
52 +// commit since that would cause mismatching user timing API calls.
53 let timeout = null;
54 function updateFlagOutsideOfReactCallStack() {
55 if (!timeout) {