1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @flow strict
    
  8.  */
    
  9. 
    
  10. // -----------------------------------------------------------------------------
    
  11. // Land or remove (zero effort)
    
  12. //
    
  13. // Flags that can likely be deleted or landed without consequences
    
  14. // -----------------------------------------------------------------------------
    
  15. 
    
  16. export const enableComponentStackLocations = true;
    
  17. 
    
  18. // -----------------------------------------------------------------------------
    
  19. // Killswitch
    
  20. //
    
  21. // Flags that exist solely to turn off a change in case it causes a regression
    
  22. // when it rolls out to prod. We should remove these as soon as possible.
    
  23. // -----------------------------------------------------------------------------
    
  24. 
    
  25. // -----------------------------------------------------------------------------
    
  26. // Land or remove (moderate effort)
    
  27. //
    
  28. // Flags that can be probably deleted or landed, but might require extra effort
    
  29. // like migrating internal callers or performance testing.
    
  30. // -----------------------------------------------------------------------------
    
  31. 
    
  32. // TODO: Finish rolling out in www
    
  33. export const enableClientRenderFallbackOnTextMismatch = true;
    
  34. export const enableFormActions = true;
    
  35. export const enableAsyncActions = true;
    
  36. 
    
  37. // Not sure if www still uses this. We don't have a replacement but whatever we
    
  38. // replace it with will likely be different than what's already there, so we
    
  39. // probably should just delete it as long as nothing in www relies on it.
    
  40. export const enableSchedulerDebugging = false;
    
  41. 
    
  42. // Need to remove didTimeout argument from Scheduler before landing
    
  43. export const disableSchedulerTimeoutInWorkLoop = false;
    
  44. 
    
  45. // This will break some internal tests at Meta so we need to gate this until
    
  46. // those can be fixed.
    
  47. export const enableDeferRootSchedulingToMicrotask = true;
    
  48. 
    
  49. // -----------------------------------------------------------------------------
    
  50. // Slated for removal in the future (significant effort)
    
  51. //
    
  52. // These are experiments that didn't work out, and never shipped, but we can't
    
  53. // delete from the codebase until we migrate internal callers.
    
  54. // -----------------------------------------------------------------------------
    
  55. 
    
  56. // Add a callback property to suspense to notify which promises are currently
    
  57. // in the update queue. This allows reporting and tracing of what is causing
    
  58. // the user to see a loading state.
    
  59. //
    
  60. // Also allows hydration callbacks to fire when a dehydrated boundary gets
    
  61. // hydrated or deleted.
    
  62. //
    
  63. // This will eventually be replaced by the Transition Tracing proposal.
    
  64. export const enableSuspenseCallback = false;
    
  65. 
    
  66. // Experimental Scope support.
    
  67. export const enableScopeAPI = false;
    
  68. 
    
  69. // Experimental Create Event Handle API.
    
  70. export const enableCreateEventHandleAPI = false;
    
  71. 
    
  72. // Support legacy Primer support on internal FB www
    
  73. export const enableLegacyFBSupport = false;
    
  74. 
    
  75. // -----------------------------------------------------------------------------
    
  76. // Ongoing experiments
    
  77. //
    
  78. // These are features that we're either actively exploring or are reasonably
    
  79. // likely to include in an upcoming release.
    
  80. // -----------------------------------------------------------------------------
    
  81. 
    
  82. export const enableCache = true;
    
  83. export const enableLegacyCache = __EXPERIMENTAL__;
    
  84. export const enableCacheElement = __EXPERIMENTAL__;
    
  85. export const enableFetchInstrumentation = true;
    
  86. 
    
  87. export const enableBinaryFlight = __EXPERIMENTAL__;
    
  88. 
    
  89. export const enableTaint = __EXPERIMENTAL__;
    
  90. 
    
  91. export const enablePostpone = __EXPERIMENTAL__;
    
  92. 
    
  93. export const enableTransitionTracing = false;
    
  94. 
    
  95. // No known bugs, but needs performance testing
    
  96. export const enableLazyContextPropagation = false;
    
  97. 
    
  98. // FB-only usage. The new API has different semantics.
    
  99. export const enableLegacyHidden = false;
    
  100. 
    
  101. // Enables unstable_avoidThisFallback feature in Fiber
    
  102. export const enableSuspenseAvoidThisFallback = false;
    
  103. // Enables unstable_avoidThisFallback feature in Fizz
    
  104. export const enableSuspenseAvoidThisFallbackFizz = false;
    
  105. 
    
  106. export const enableCPUSuspense = __EXPERIMENTAL__;
    
  107. 
    
  108. export const enableHostSingletons = true;
    
  109. 
    
  110. export const enableFloat = true;
    
  111. 
    
  112. // Enables unstable_useMemoCache hook, intended as a compilation target for
    
  113. // auto-memoization.
    
  114. export const enableUseMemoCacheHook = __EXPERIMENTAL__;
    
  115. 
    
  116. export const enableUseEffectEventHook = __EXPERIMENTAL__;
    
  117. 
    
  118. // Test in www before enabling in open source.
    
  119. // Enables DOM-server to stream its instruction set as data-attributes
    
  120. // (handled with an MutationObserver) instead of inline-scripts
    
  121. export const enableFizzExternalRuntime = true;
    
  122. 
    
  123. export const alwaysThrottleRetries = true;
    
  124. 
    
  125. export const useMicrotasksForSchedulingInFabric = false;
    
  126. 
    
  127. export const passChildrenWhenCloningPersistedNodes = false;
    
  128. 
    
  129. export const enableUseDeferredValueInitialArg = __EXPERIMENTAL__;
    
  130. 
    
  131. // -----------------------------------------------------------------------------
    
  132. // Chopping Block
    
  133. //
    
  134. // Planned feature deprecations and breaking changes. Sorted roughly in order of
    
  135. // when we plan to enable them.
    
  136. // -----------------------------------------------------------------------------
    
  137. 
    
  138. // This flag enables Strict Effects by default. We're not turning this on until
    
  139. // after 18 because it requires migration work. Recommendation is to use
    
  140. // <StrictMode /> to gradually upgrade components.
    
  141. // If TRUE, trees rendered with createRoot will be StrictEffectsMode.
    
  142. // If FALSE, these trees will be StrictLegacyMode.
    
  143. export const createRootStrictEffectsByDefault = false;
    
  144. 
    
  145. export const disableModulePatternComponents = false;
    
  146. 
    
  147. export const disableLegacyContext = false;
    
  148. 
    
  149. export const enableUseRefAccessWarning = false;
    
  150. 
    
  151. // Enables time slicing for updates that aren't wrapped in startTransition.
    
  152. export const forceConcurrentByDefaultForTesting = false;
    
  153. 
    
  154. export const enableUnifiedSyncLane = __EXPERIMENTAL__;
    
  155. 
    
  156. // Adds an opt-in to time slicing for updates that aren't wrapped in startTransition.
    
  157. export const allowConcurrentByDefault = false;
    
  158. 
    
  159. // -----------------------------------------------------------------------------
    
  160. // React DOM Chopping Block
    
  161. //
    
  162. // Similar to main Chopping Block but only flags related to React DOM. These are
    
  163. // grouped because we will likely batch all of them into a single major release.
    
  164. // -----------------------------------------------------------------------------
    
  165. 
    
  166. // Disable support for comment nodes as React DOM containers. Already disabled
    
  167. // in open source, but www codebase still relies on it. Need to remove.
    
  168. export const disableCommentsAsDOMContainers = true;
    
  169. 
    
  170. // Disable javascript: URL strings in href for XSS protection.
    
  171. export const disableJavaScriptURLs = false;
    
  172. 
    
  173. export const enableTrustedTypesIntegration = false;
    
  174. 
    
  175. // Prevent the value and checked attributes from syncing with their related
    
  176. // DOM properties
    
  177. export const disableInputAttributeSyncing = false;
    
  178. 
    
  179. // Remove IE and MsApp specific workarounds for innerHTML
    
  180. export const disableIEWorkarounds = __EXPERIMENTAL__;
    
  181. 
    
  182. // Filter certain DOM attributes (e.g. src, href) if their values are empty
    
  183. // strings. This prevents e.g. <img src=""> from making an unnecessary HTTP
    
  184. // request for certain browsers.
    
  185. export const enableFilterEmptyStringAttributesDOM = __EXPERIMENTAL__;
    
  186. 
    
  187. // Changes the behavior for rendering custom elements in both server rendering
    
  188. // and client rendering, mostly to allow JSX attributes to apply to the custom
    
  189. // element's object properties instead of only HTML attributes.
    
  190. // https://github.com/facebook/react/issues/11347
    
  191. export const enableCustomElementPropertySupport = __EXPERIMENTAL__;
    
  192. 
    
  193. // Disables children for <textarea> elements
    
  194. export const disableTextareaChildren = false;
    
  195. 
    
  196. // -----------------------------------------------------------------------------
    
  197. // Debugging and DevTools
    
  198. // -----------------------------------------------------------------------------
    
  199. 
    
  200. // Adds user timing marks for e.g. state updates, suspense, and work loop stuff,
    
  201. // for an experimental timeline tool.
    
  202. export const enableSchedulingProfiler = __PROFILE__;
    
  203. 
    
  204. // Helps identify side effects in render-phase lifecycle hooks and setState
    
  205. // reducers by double invoking them in StrictLegacyMode.
    
  206. export const debugRenderPhaseSideEffectsForStrictMode = __DEV__;
    
  207. 
    
  208. // To preserve the "Pause on caught exceptions" behavior of the debugger, we
    
  209. // replay the begin phase of a failed component inside invokeGuardedCallback.
    
  210. export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
    
  211. 
    
  212. // Gather advanced timing metrics for Profiler subtrees.
    
  213. export const enableProfilerTimer = __PROFILE__;
    
  214. 
    
  215. // Record durations for commit and passive effects phases.
    
  216. export const enableProfilerCommitHooks = __PROFILE__;
    
  217. 
    
  218. // Phase param passed to onRender callback differentiates between an "update" and a "cascading-update".
    
  219. export const enableProfilerNestedUpdatePhase = __PROFILE__;
    
  220. 
    
  221. // Adds verbose console logging for e.g. state updates, suspense, and work loop
    
  222. // stuff. Intended to enable React core members to more easily debug scheduling
    
  223. // issues in DEV builds.
    
  224. export const enableDebugTracing = false;
    
  225. 
    
  226. // Track which Fiber(s) schedule render work.
    
  227. export const enableUpdaterTracking = __PROFILE__;
    
  228. 
    
  229. export const enableServerContext = __EXPERIMENTAL__;
    
  230. 
    
  231. // Internal only.
    
  232. export const enableGetInspectorDataForInstanceInProduction = false;
    
  233. 
    
  234. // Profiler API accepts a function to be called when a nested update is scheduled.
    
  235. // This callback accepts the component type (class instance or function) the update is scheduled for.
    
  236. export const enableProfilerNestedUpdateScheduledHook = false;
    
  237. 
    
  238. export const consoleManagedByDevToolsDuringStrictMode = true;
    
  239. 
    
  240. // Modern <StrictMode /> behaviour aligns more with what components
    
  241. // components will encounter in production, especially when used With <Offscreen />.
    
  242. // TODO: clean up legacy <StrictMode /> once tests pass WWW.
    
  243. export const useModernStrictMode = false;
    
  244. export const enableDO_NOT_USE_disableStrictPassiveEffect = false;