mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Depends on: - #28317 - #28320 --- Changes the behavior of the JSX runtime to pass through `ref` as a normal prop, rather than plucking it from the props object and storing on the element. This is a breaking change since it changes the type of the receiving component. However, most code is unaffected since it's unlikely that a component would have attempted to access a `ref` prop, since it was not possible to get a reference to one. `forwardRef` _will_ still pluck `ref` from the props object, though, since it's extremely common for users to spread the props object onto the inner component and pass `ref` as a differently named prop. This is for maximum compatibility with existing code — the real impact of this change is that `forwardRef` is no longer required. Currently, refs are resolved during child reconciliation and stored on the fiber. As a result of this change, we can move ref resolution to happen only much later, and only for components that actually use them. Then we can remove the `ref` field from the Fiber type. I have not yet done that in this step, though.
125 lines
4.1 KiB
JavaScript
125 lines
4.1 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
|
|
import typeof * as ExportsType from './ReactFeatureFlags.www';
|
|
import typeof * as DynamicFeatureFlags from './ReactFeatureFlags.www-dynamic';
|
|
|
|
// Re-export dynamic flags from the www version.
|
|
const dynamicFeatureFlags: DynamicFeatureFlags = require('ReactFeatureFlags');
|
|
|
|
export const {
|
|
disableInputAttributeSyncing,
|
|
disableIEWorkarounds,
|
|
enableTrustedTypesIntegration,
|
|
replayFailedUnitOfWorkWithInvokeGuardedCallback,
|
|
enableLegacyFBSupport,
|
|
enableDebugTracing,
|
|
enableUseRefAccessWarning,
|
|
enableLazyContextPropagation,
|
|
enableUnifiedSyncLane,
|
|
enableRetryLaneExpiration,
|
|
enableTransitionTracing,
|
|
enableDeferRootSchedulingToMicrotask,
|
|
alwaysThrottleRetries,
|
|
enableDO_NOT_USE_disableStrictPassiveEffect,
|
|
disableSchedulerTimeoutInWorkLoop,
|
|
enableUseDeferredValueInitialArg,
|
|
retryLaneExpirationMs,
|
|
syncLaneExpirationMs,
|
|
transitionLaneExpirationMs,
|
|
enableInfiniteRenderLoopDetection,
|
|
enableRenderableContext,
|
|
useModernStrictMode,
|
|
} = dynamicFeatureFlags;
|
|
|
|
// On WWW, __EXPERIMENTAL__ is used for a new modern build.
|
|
// It's not used anywhere in production yet.
|
|
|
|
export const debugRenderPhaseSideEffectsForStrictMode = __DEV__;
|
|
export const enableProfilerTimer = __PROFILE__;
|
|
export const enableProfilerCommitHooks = __PROFILE__;
|
|
export const enableProfilerNestedUpdatePhase = __PROFILE__;
|
|
export const enableProfilerNestedUpdateScheduledHook: boolean =
|
|
__PROFILE__ && dynamicFeatureFlags.enableProfilerNestedUpdateScheduledHook;
|
|
export const enableUpdaterTracking = __PROFILE__;
|
|
|
|
export const enableSuspenseAvoidThisFallback = true;
|
|
export const enableSuspenseAvoidThisFallbackFizz = false;
|
|
|
|
export const enableCustomElementPropertySupport = true;
|
|
export const enableCPUSuspense = true;
|
|
export const enableFloat = true;
|
|
export const enableUseMemoCacheHook = true;
|
|
export const enableUseEffectEventHook = true;
|
|
export const enableClientRenderFallbackOnTextMismatch = false;
|
|
export const enableFilterEmptyStringAttributesDOM = true;
|
|
export const enableFormActions = true;
|
|
export const enableAsyncActions = true;
|
|
|
|
// Logs additional User Timing API marks for use with an experimental profiling tool.
|
|
export const enableSchedulingProfiler: boolean =
|
|
__PROFILE__ && dynamicFeatureFlags.enableSchedulingProfiler;
|
|
|
|
export const disableLegacyContext = __EXPERIMENTAL__;
|
|
export const enableGetInspectorDataForInstanceInProduction = false;
|
|
|
|
export const enableCache = true;
|
|
export const enableLegacyCache = true;
|
|
export const enableCacheElement = true;
|
|
export const enableFetchInstrumentation = false;
|
|
|
|
export const enableBinaryFlight = false;
|
|
export const enableTaint = false;
|
|
|
|
export const enablePostpone = false;
|
|
|
|
export const disableJavaScriptURLs = true;
|
|
|
|
// TODO: www currently relies on this feature. It's disabled in open source.
|
|
// Need to remove it.
|
|
export const disableCommentsAsDOMContainers = false;
|
|
|
|
export const disableModulePatternComponents = true;
|
|
|
|
export const enableCreateEventHandleAPI = true;
|
|
|
|
export const enableScopeAPI = true;
|
|
|
|
export const enableSuspenseCallback = true;
|
|
|
|
export const enableLegacyHidden = true;
|
|
|
|
export const enableComponentStackLocations = true;
|
|
|
|
export const disableTextareaChildren = __EXPERIMENTAL__;
|
|
|
|
export const allowConcurrentByDefault = true;
|
|
|
|
export const consoleManagedByDevToolsDuringStrictMode = true;
|
|
|
|
export const enableFizzExternalRuntime = true;
|
|
|
|
export const forceConcurrentByDefaultForTesting = false;
|
|
|
|
export const useMicrotasksForSchedulingInFabric = false;
|
|
export const passChildrenWhenCloningPersistedNodes = false;
|
|
|
|
export const enableAsyncDebugInfo = false;
|
|
export const disableClientCache = true;
|
|
|
|
export const enableServerComponentKeys = true;
|
|
|
|
// TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
|
|
// because JSX is an extremely hot path.
|
|
export const enableRefAsProp = false;
|
|
|
|
// Flow magic to verify the exports of this file match the original version.
|
|
((((null: any): ExportsType): FeatureFlagsType): ExportsType);
|