mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Split static and dynamic www feature flags (#11471)
This commit is contained in:
@@ -10,18 +10,27 @@
|
||||
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
|
||||
import typeof * as FeatureFlagsShimType from './ReactFeatureFlags-www';
|
||||
|
||||
// Re-export all flags from the www version.
|
||||
// Re-export dynamic flags from the www version.
|
||||
export const {
|
||||
enableAsyncSubtreeAPI,
|
||||
enableAsyncSchedulingByDefaultInReactDOM,
|
||||
enableReactFragment,
|
||||
enableCreateRoot,
|
||||
// Reconciler flags
|
||||
enableMutatingReconciler,
|
||||
enableNoopReconciler,
|
||||
enablePersistentReconciler,
|
||||
} = require('ReactFeatureFlags');
|
||||
|
||||
// The rest of the flags are static for better dead code elimination.
|
||||
export const enableAsyncSubtreeAPI = true;
|
||||
export const enableReactFragment = false;
|
||||
export const enableCreateRoot = false;
|
||||
|
||||
// The www bundles only use the mutating reconciler.
|
||||
export const enableMutatingReconciler = true;
|
||||
export const enableNoopReconciler = false;
|
||||
export const enablePersistentReconciler = false;
|
||||
|
||||
// In www, we have experimental support for gathering data
|
||||
// from User Timing API calls in production. By default, we
|
||||
// only emit performance.mark/measure calls in __DEV__. But if
|
||||
// somebody calls addUserTimingListener() which is exposed as an
|
||||
// experimental FB-only export, we call performance.mark/measure
|
||||
// as long as there is more than a single listener.
|
||||
export let enableUserTimingAPI = __DEV__;
|
||||
|
||||
let refCount = 0;
|
||||
@@ -38,6 +47,9 @@ export function addUserTimingListener() {
|
||||
};
|
||||
}
|
||||
|
||||
// The flag is intentionally updated in a timeout.
|
||||
// We don't support toggling it during reconciliation or
|
||||
// commit since that would cause mismatching user timing API calls.
|
||||
let timeout = null;
|
||||
function updateFlagOutsideOfReactCallStack() {
|
||||
if (!timeout) {
|
||||
|
||||
Reference in New Issue
Block a user