|
7 | 7 | * @flow strict |
8 | 8 | */ |
9 | 9 |
|
10 | | -// Filter certain DOM attributes (e.g. src, href) if their values are empty strings. |
11 | | -// This prevents e.g. <img src=""> from making an unnecessary HTTP request for certain browsers. |
12 | | -export const enableFilterEmptyStringAttributesDOM = false; |
13 | | - |
14 | | -// Adds verbose console logging for e.g. state updates, suspense, and work loop stuff. |
15 | | -// Intended to enable React core members to more easily debug scheduling issues in DEV builds. |
16 | | -export const enableDebugTracing = false; |
17 | | - |
18 | | -// Adds user timing marks for e.g. state updates, suspense, and work loop stuff, |
19 | | -// for an experimental timeline tool. |
20 | | -export const enableSchedulingProfiler = __PROFILE__; |
21 | | - |
22 | | -// Helps identify side effects in render-phase lifecycle hooks and setState |
23 | | -// reducers by double invoking them in StrictLegacyMode. |
24 | | -export const debugRenderPhaseSideEffectsForStrictMode = __DEV__; |
25 | | - |
26 | | -// Helps identify code that is not safe for planned Offscreen API and Suspense semantics; |
27 | | -// this feature flag only impacts StrictEffectsMode. |
28 | | -export const enableStrictEffects = __DEV__; |
29 | | - |
30 | | -// If TRUE, trees rendered with createRoot will be StrictEffectsMode. |
31 | | -// If FALSE, these trees will be StrictLegacyMode. |
32 | | -export const createRootStrictEffectsByDefault = false; |
33 | | - |
34 | | -// To preserve the "Pause on caught exceptions" behavior of the debugger, we |
35 | | -// replay the begin phase of a failed component inside invokeGuardedCallback. |
36 | | -export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__; |
37 | | - |
38 | | -// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6: |
39 | | -export const warnAboutDeprecatedLifecycles = true; |
40 | | - |
41 | | -// Gather advanced timing metrics for Profiler subtrees. |
42 | | -export const enableProfilerTimer = __PROFILE__; |
43 | | - |
44 | | -// Record durations for commit and passive effects phases. |
45 | | -export const enableProfilerCommitHooks = __PROFILE__; |
46 | | - |
47 | | -// Phase param passed to onRender callback differentiates between an "update" and a "cascading-update". |
48 | | -export const enableProfilerNestedUpdatePhase = __PROFILE__; |
49 | | - |
50 | | -// Profiler API accepts a function to be called when a nested update is scheduled. |
51 | | -// This callback accepts the component type (class instance or function) the update is scheduled for. |
52 | | -export const enableProfilerNestedUpdateScheduledHook = false; |
53 | | - |
54 | | -// Track which Fiber(s) schedule render work. |
55 | | -export const enableUpdaterTracking = __PROFILE__; |
| 10 | +// ----------------------------------------------------------------------------- |
| 11 | +// Land or remove (zero effort) |
| 12 | +// |
| 13 | +// Flags that can likely be deleted or landed without consequences |
| 14 | +// ----------------------------------------------------------------------------- |
56 | 15 |
|
57 | | -// SSR experiments |
| 16 | +export const warnOnSubscriptionInsideStartTransition = false; |
58 | 17 | export const enableSuspenseServerRenderer = true; |
59 | 18 | export const enableSelectiveHydration = true; |
60 | | - |
61 | | -// Flight experiments |
| 19 | +export const warnAboutDeprecatedLifecycles = true; |
62 | 20 | export const enableLazyElements = true; |
63 | | -export const enableCache = __EXPERIMENTAL__; |
| 21 | +export const enableComponentStackLocations = true; |
| 22 | +export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; |
| 23 | +export const warnUnstableRenderSubtreeIntoContainer = false; |
| 24 | +export const enablePersistentOffscreenHostContainer = false; |
64 | 25 |
|
65 | | -// Only used in www builds. |
66 | | -export const enableSchedulerDebugging = false; |
| 26 | +// ----------------------------------------------------------------------------- |
| 27 | +// Land or remove (moderate effort) |
| 28 | +// |
| 29 | +// Flags that can be probably deleted or landed, but might require extra effort |
| 30 | +// like migrating internal callers or performance testing. |
| 31 | +// ----------------------------------------------------------------------------- |
| 32 | + |
| 33 | +// Destroy layout effects for components that are hidden because something |
| 34 | +// suspended in an update and recreate them when they are shown again (after the |
| 35 | +// suspended boundary has resolved). Note that this should be an uncommon use |
| 36 | +// case and can be avoided by using the transition API. |
| 37 | +// |
| 38 | +// TODO: Finish rolling out in www |
| 39 | +export const enableSuspenseLayoutEffectSemantics = true; |
67 | 40 |
|
68 | | -// Disable javascript: URL strings in href for XSS protection. |
69 | | -export const disableJavaScriptURLs = false; |
| 41 | +// TODO: Finish rolling out in www |
| 42 | +export const enableClientRenderFallbackOnHydrationMismatch = true; |
70 | 43 |
|
71 | | -// Disable support for comment nodes as React DOM containers. Only supported |
72 | | -// by www builds. |
73 | | -export const disableCommentsAsDOMContainers = true; |
| 44 | +// TODO: Need to review this code one more time before landing |
| 45 | +export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; |
74 | 46 |
|
75 | | -// Experimental Scope support. |
76 | | -export const enableScopeAPI = false; |
| 47 | +// Recoil still uses useMutableSource in www, need to delete |
| 48 | +export const enableUseMutableSource = false; |
77 | 49 |
|
78 | | -// Experimental Create Event Handle API. |
79 | | -export const enableCreateEventHandleAPI = false; |
| 50 | +// Not sure if www still uses this. We don't have a replacement but whatever we |
| 51 | +// replace it with will likely be different than what's already there, so we |
| 52 | +// probably should just delete it as long as nothing in www relies on it. |
| 53 | +export const enableSchedulerDebugging = false; |
80 | 54 |
|
81 | | -// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107 |
| 55 | +// Need to remove didTimeout argument from Scheduler before landing |
| 56 | +export const disableSchedulerTimeoutInWorkLoop = false; |
82 | 57 |
|
83 | | -// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v18?) |
84 | | -// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version |
| 58 | +// ----------------------------------------------------------------------------- |
| 59 | +// Slated for removal in the future (significant effort) |
| 60 | +// |
| 61 | +// These are experiments that didn't work out, and never shipped, but we can't |
| 62 | +// delete from the codebase until we migrate internal callers. |
| 63 | +// ----------------------------------------------------------------------------- |
85 | 64 |
|
86 | 65 | // Add a callback property to suspense to notify which promises are currently |
87 | 66 | // in the update queue. This allows reporting and tracing of what is causing |
88 | 67 | // the user to see a loading state. |
| 68 | +// |
89 | 69 | // Also allows hydration callbacks to fire when a dehydrated boundary gets |
90 | 70 | // hydrated or deleted. |
| 71 | +// |
| 72 | +// This will eventually be replaced by the Transition Tracing proposal. |
91 | 73 | export const enableSuspenseCallback = false; |
92 | 74 |
|
93 | | -// Part of the simplification of React.createElement so we can eventually move |
94 | | -// from React.createElement to React.jsx |
95 | | -// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md |
96 | | -export const warnAboutDefaultPropsOnFunctionComponents = false; |
97 | | - |
98 | | -export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; |
99 | | - |
100 | | -export const enableTrustedTypesIntegration = false; |
101 | | - |
102 | | -// Enables a warning when trying to spread a 'key' to an element; |
103 | | -// a deprecated pattern we want to get rid of in the future |
104 | | -export const warnAboutSpreadingKeyToJSX = false; |
| 75 | +// Experimental Scope support. |
| 76 | +export const enableScopeAPI = false; |
105 | 77 |
|
106 | | -export const warnOnSubscriptionInsideStartTransition = false; |
| 78 | +// Experimental Create Event Handle API. |
| 79 | +export const enableCreateEventHandleAPI = false; |
107 | 80 |
|
108 | | -export const enableSuspenseAvoidThisFallback = false; |
109 | | -export const enableSuspenseAvoidThisFallbackFizz = false; |
| 81 | +// This controls whether you get the `.old` modules or the `.new` modules in |
| 82 | +// the react-reconciler package. |
| 83 | +export const enableNewReconciler = false; |
110 | 84 |
|
111 | | -export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; |
| 85 | +// Support legacy Primer support on internal FB www |
| 86 | +export const enableLegacyFBSupport = false; |
112 | 87 |
|
113 | | -export const enableClientRenderFallbackOnHydrationMismatch = true; |
| 88 | +// ----------------------------------------------------------------------------- |
| 89 | +// Ongoing experiments |
| 90 | +// |
| 91 | +// These are features that we're either actively exploring or are reasonably |
| 92 | +// likely to include in an upcoming release. |
| 93 | +// ----------------------------------------------------------------------------- |
114 | 94 |
|
115 | | -export const enableComponentStackLocations = true; |
| 95 | +export const enableCache = __EXPERIMENTAL__; |
116 | 96 |
|
117 | | -export const enableNewReconciler = false; |
| 97 | +export const enableTransitionTracing = false; |
118 | 98 |
|
119 | | -export const disableNativeComponentFrames = false; |
| 99 | +// No known bugs, but needs performance testing |
| 100 | +export const enableLazyContextPropagation = false; |
120 | 101 |
|
121 | | -// Internal only. |
122 | | -export const enableGetInspectorDataForInstanceInProduction = false; |
| 102 | +// Enables unstable_avoidThisFallback feature in Fiber |
| 103 | +export const enableSuspenseAvoidThisFallback = false; |
| 104 | +// Enables unstable_avoidThisFallback feature in Fizz |
| 105 | +export const enableSuspenseAvoidThisFallbackFizz = false; |
123 | 106 |
|
124 | 107 | // When a node is unmounted, recurse into the Fiber subtree and clean out |
125 | 108 | // references. Each level cleans up more fiber fields than the previous level. |
@@ -134,62 +117,140 @@ export const enableGetInspectorDataForInstanceInProduction = false; |
134 | 117 | // aggressiveness. |
135 | 118 | export const deletedTreeCleanUpLevel = 3; |
136 | 119 |
|
137 | | -// Destroy layout effects for components that are hidden because something suspended in an update |
138 | | -// and recreate them when they are shown again (after the suspended boundary has resolved). |
139 | | -// Note that this should be an uncommon use case and can be avoided by using the transition API. |
140 | | -export const enableSuspenseLayoutEffectSemantics = true; |
| 120 | +// ----------------------------------------------------------------------------- |
| 121 | +// Chopping Block |
| 122 | +// |
| 123 | +// Planned feature deprecations and breaking changes. Sorted roughly in order of |
| 124 | +// when we we plan to enable them. |
| 125 | +// ----------------------------------------------------------------------------- |
| 126 | + |
| 127 | +// This flag enables Strict Effects by default. We're not turning this on until |
| 128 | +// after 18 because it requires migration work. Recommendation is to use |
| 129 | +// <StrictMode /> to gradually upgrade components. |
| 130 | +// If TRUE, trees rendered with createRoot will be StrictEffectsMode. |
| 131 | +// If FALSE, these trees will be StrictLegacyMode. |
| 132 | +export const createRootStrictEffectsByDefault = false; |
| 133 | + |
| 134 | +export const disableModulePatternComponents = false; |
| 135 | + |
| 136 | +export const disableLegacyContext = false; |
| 137 | + |
| 138 | +export const enableUseRefAccessWarning = false; |
| 139 | + |
| 140 | +// Enables time slicing for updates that aren't wrapped in startTransition. |
| 141 | +export const enableSyncDefaultUpdates = true; |
| 142 | + |
| 143 | +// Adds an opt-in to time slicing for updates that aren't wrapped in |
| 144 | +// startTransition. Only relevant when enableSyncDefaultUpdates is disabled. |
| 145 | +export const allowConcurrentByDefault = false; |
| 146 | + |
| 147 | +// Updates that occur in the render phase are not officially supported. But when |
| 148 | +// they do occur, we defer them to a subsequent render by picking a lane that's |
| 149 | +// not currently rendering. We treat them the same as if they came from an |
| 150 | +// interleaved event. Remove this flag once we have migrated to the |
| 151 | +// new behavior. |
| 152 | +// NOTE: Not sure if we'll end up doing this or not. |
| 153 | +export const deferRenderPhaseUpdateToNextBatch = false; |
| 154 | + |
| 155 | +// ----------------------------------------------------------------------------- |
| 156 | +// React DOM Chopping Block |
| 157 | +// |
| 158 | +// Similar to main Chopping Block but only flags related to React DOM. These are |
| 159 | +// grouped because we will likely batch all of them into a single major release. |
| 160 | +// ----------------------------------------------------------------------------- |
| 161 | + |
| 162 | +// Disable support for comment nodes as React DOM containers. Already disabled |
| 163 | +// in open source, but www codebase still relies on it. Need to remove. |
| 164 | +export const disableCommentsAsDOMContainers = true; |
| 165 | + |
| 166 | +// Disable javascript: URL strings in href for XSS protection. |
| 167 | +export const disableJavaScriptURLs = false; |
| 168 | + |
| 169 | +export const enableTrustedTypesIntegration = false; |
| 170 | + |
| 171 | +// Prevent the value and checked attributes from syncing with their related |
| 172 | +// DOM properties |
| 173 | +export const disableInputAttributeSyncing = false; |
| 174 | + |
| 175 | +// Filter certain DOM attributes (e.g. src, href) if their values are empty |
| 176 | +// strings. This prevents e.g. <img src=""> from making an unnecessary HTTP |
| 177 | +// request for certain browsers. |
| 178 | +export const enableFilterEmptyStringAttributesDOM = false; |
141 | 179 |
|
142 | 180 | // Changes the behavior for rendering custom elements in both server rendering |
143 | 181 | // and client rendering, mostly to allow JSX attributes to apply to the custom |
144 | 182 | // element's object properties instead of only HTML attributes. |
145 | 183 | // https://github.com/facebook/react/issues/11347 |
146 | 184 | export const enableCustomElementPropertySupport = __EXPERIMENTAL__; |
147 | 185 |
|
148 | | -// -------------------------- |
149 | | -// Future APIs to be deprecated |
150 | | -// -------------------------- |
| 186 | +// Disables children for <textarea> elements |
| 187 | +export const disableTextareaChildren = false; |
151 | 188 |
|
152 | | -// Prevent the value and checked attributes from syncing |
153 | | -// with their related DOM properties |
154 | | -export const disableInputAttributeSyncing = false; |
| 189 | +// ----------------------------------------------------------------------------- |
| 190 | +// JSX Chopping Block |
| 191 | +// |
| 192 | +// Similar to main Chopping Block but only flags related to JSX. These are |
| 193 | +// grouped because we will likely batch all of them into a single major release. |
| 194 | +// ----------------------------------------------------------------------------- |
155 | 195 |
|
156 | | -export const warnAboutStringRefs = false; |
| 196 | +// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107 |
157 | 197 |
|
158 | | -export const disableLegacyContext = false; |
| 198 | +// Part of the simplification of React.createElement so we can eventually move |
| 199 | +// from React.createElement to React.jsx |
| 200 | +// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md |
| 201 | +export const warnAboutDefaultPropsOnFunctionComponents = false; // deprecate later, not 18.0 |
159 | 202 |
|
160 | | -// Disables children for <textarea> elements |
161 | | -export const disableTextareaChildren = false; |
| 203 | +// Enables a warning when trying to spread a 'key' to an element; |
| 204 | +// a deprecated pattern we want to get rid of in the future |
| 205 | +export const warnAboutSpreadingKeyToJSX = false; |
162 | 206 |
|
163 | | -export const disableModulePatternComponents = false; |
| 207 | +export const warnAboutStringRefs = false; |
164 | 208 |
|
165 | | -// We should remove this flag once the above flag becomes enabled |
166 | | -export const warnUnstableRenderSubtreeIntoContainer = false; |
| 209 | +// ----------------------------------------------------------------------------- |
| 210 | +// Debugging and DevTools |
| 211 | +// ----------------------------------------------------------------------------- |
167 | 212 |
|
168 | | -// Support legacy Primer support on internal FB www |
169 | | -export const enableLegacyFBSupport = false; |
| 213 | +// Adds user timing marks for e.g. state updates, suspense, and work loop stuff, |
| 214 | +// for an experimental timeline tool. |
| 215 | +export const enableSchedulingProfiler = __PROFILE__; |
170 | 216 |
|
171 | | -// Updates that occur in the render phase are not officially supported. But when |
172 | | -// they do occur, we defer them to a subsequent render by picking a lane that's |
173 | | -// not currently rendering. We treat them the same as if they came from an |
174 | | -// interleaved event. Remove this flag once we have migrated to the |
175 | | -// new behavior. |
176 | | -export const deferRenderPhaseUpdateToNextBatch = false; |
| 217 | +// Helps identify side effects in render-phase lifecycle hooks and setState |
| 218 | +// reducers by double invoking them in StrictLegacyMode. |
| 219 | +export const debugRenderPhaseSideEffectsForStrictMode = __DEV__; |
177 | 220 |
|
178 | | -export const enableUseRefAccessWarning = false; |
| 221 | +// Helps identify code that is not safe for planned Offscreen API and Suspense semantics; |
| 222 | +// this feature flag only impacts StrictEffectsMode. |
| 223 | +export const enableStrictEffects = __DEV__; |
179 | 224 |
|
180 | | -export const disableSchedulerTimeoutInWorkLoop = false; |
| 225 | +// To preserve the "Pause on caught exceptions" behavior of the debugger, we |
| 226 | +// replay the begin phase of a failed component inside invokeGuardedCallback. |
| 227 | +export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__; |
181 | 228 |
|
182 | | -export const enableLazyContextPropagation = false; |
| 229 | +// Gather advanced timing metrics for Profiler subtrees. |
| 230 | +export const enableProfilerTimer = __PROFILE__; |
183 | 231 |
|
184 | | -export const enableSyncDefaultUpdates = true; |
| 232 | +// Record durations for commit and passive effects phases. |
| 233 | +export const enableProfilerCommitHooks = __PROFILE__; |
185 | 234 |
|
186 | | -export const allowConcurrentByDefault = false; |
| 235 | +// Phase param passed to onRender callback differentiates between an "update" and a "cascading-update". |
| 236 | +export const enableProfilerNestedUpdatePhase = __PROFILE__; |
187 | 237 |
|
188 | | -export const enablePersistentOffscreenHostContainer = false; |
| 238 | +// Adds verbose console logging for e.g. state updates, suspense, and work loop |
| 239 | +// stuff. Intended to enable React core members to more easily debug scheduling |
| 240 | +// issues in DEV builds. |
| 241 | +export const enableDebugTracing = false; |
189 | 242 |
|
190 | | -export const consoleManagedByDevToolsDuringStrictMode = true; |
| 243 | +// Track which Fiber(s) schedule render work. |
| 244 | +export const enableUpdaterTracking = __PROFILE__; |
191 | 245 |
|
192 | | -// Only enabled in www builds |
193 | | -export const enableUseMutableSource = false; |
| 246 | +// Only enabled in RN, related to enableComponentStackLocations |
| 247 | +export const disableNativeComponentFrames = false; |
194 | 248 |
|
195 | | -export const enableTransitionTracing = false; |
| 249 | +// Internal only. |
| 250 | +export const enableGetInspectorDataForInstanceInProduction = false; |
| 251 | + |
| 252 | +// Profiler API accepts a function to be called when a nested update is scheduled. |
| 253 | +// This callback accepts the component type (class instance or function) the update is scheduled for. |
| 254 | +export const enableProfilerNestedUpdateScheduledHook = false; |
| 255 | + |
| 256 | +export const consoleManagedByDevToolsDuringStrictMode = true; |