mirror of
https://github.com/facebook/react.git
synced 2026-02-21 19:31:52 +00:00
## Overview Adds a feature flag `enableParallelTransitions` to experiment with engantling transitions less often. ## Motivation Currently we over-entangle transition lanes. It's a common misunderstanding that React entangles all transitions, always. We actually will complete transitions independently in many cases. For example, [this codepen](https://codepen.io/GabbeV/pen/pvyKBrM) from [@gabbev](https://bsky.app/profile/gabbev.bsky.social/post/3m6uq2abihk2x) shows transitions completing independently. However, in many cases we entangle when we don't need to, instead of letting the independent transitons complete independently. We still want to entangle for updates that happen on the same queue. ## Example As an example of what this flag would change, consider two independent counter components: ```js function Counter({ label }) { const [count, setCount] = useState(0); return ( <div> <span>{use(readCache(`${label} ${count}`))} </span> <Button action={() => { setCount((c) => c + 1); }} > Next {label} </Button> </div> ); } ``` ```js export default function App() { return ( <> <Counter label="A" /> <Counter label="B" /> </> ); } ``` ### Before The behavior today is to entange them, meaning they always commit together: https://github.com/user-attachments/assets/adead60e-8a98-4a20-a440-1efdf85b2142 ### After In this experiment, they will complete independently (if they don't depend on each other): https://github.com/user-attachments/assets/181632b5-3c92-4a29-a571-3637f3fab8cd ## Early Research This change is in early research, and is not in the experimental channel. We're going to experiment with this at Meta to understand how much of a breaking change, and how beneficial it is before commiting to shipping it in experimental and beyond.
120 lines
3.8 KiB
JavaScript
120 lines
3.8 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 {
|
|
alwaysThrottleRetries,
|
|
disableLegacyContextForFunctionComponents,
|
|
disableSchedulerTimeoutInWorkLoop,
|
|
enableHiddenSubtreeInsertionEffectCleanup,
|
|
enableInfiniteRenderLoopDetection,
|
|
enableNoCloningMemoCache,
|
|
enableObjectFiber,
|
|
enableRetryLaneExpiration,
|
|
enableTransitionTracing,
|
|
enableTrustedTypesIntegration,
|
|
retryLaneExpirationMs,
|
|
syncLaneExpirationMs,
|
|
transitionLaneExpirationMs,
|
|
enableViewTransition,
|
|
enableScrollEndPolyfill,
|
|
enableFragmentRefs,
|
|
enableFragmentRefsScrollIntoView,
|
|
enableFragmentRefsTextNodes,
|
|
enableInternalInstanceMap,
|
|
enableParallelTransitions,
|
|
} = dynamicFeatureFlags;
|
|
|
|
// On WWW, __EXPERIMENTAL__ is used for a new modern build.
|
|
// It's not used anywhere in production yet.
|
|
|
|
export const enableProfilerTimer = __PROFILE__;
|
|
export const enableProfilerCommitHooks = __PROFILE__;
|
|
export const enableProfilerNestedUpdatePhase = __PROFILE__;
|
|
export const enableUpdaterTracking = __PROFILE__;
|
|
|
|
export const enableSuspenseAvoidThisFallback: boolean = true;
|
|
|
|
export const enableAsyncDebugInfo: boolean = true;
|
|
export const enableCPUSuspense: boolean = true;
|
|
export const enableMoveBefore: boolean = false;
|
|
export const disableInputAttributeSyncing: boolean = false;
|
|
export const enableLegacyFBSupport: boolean = true;
|
|
|
|
export const enableYieldingBeforePassive: boolean = false;
|
|
|
|
export const enableThrottledScheduling: boolean = false;
|
|
|
|
export const enableComponentPerformanceTrack: boolean = true;
|
|
|
|
export const enablePerformanceIssueReporting: boolean = false;
|
|
|
|
// 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 enableLegacyCache: boolean = true;
|
|
|
|
export const enableAsyncIterableChildren: boolean = false;
|
|
|
|
export const enableTaint: boolean = false;
|
|
|
|
export const enableHalt: boolean = true;
|
|
|
|
// TODO: www currently relies on this feature. It's disabled in open source.
|
|
// Need to remove it.
|
|
export const disableCommentsAsDOMContainers: boolean = false;
|
|
|
|
export const enableCreateEventHandleAPI: boolean = true;
|
|
|
|
export const enableScopeAPI: boolean = true;
|
|
|
|
export const enableSuspenseCallback: boolean = true;
|
|
|
|
export const enableLegacyHidden: boolean = true;
|
|
|
|
export const disableTextareaChildren = __EXPERIMENTAL__;
|
|
|
|
export const enableFizzExternalRuntime: boolean = true;
|
|
|
|
export const passChildrenWhenCloningPersistedNodes: boolean = false;
|
|
|
|
export const disableClientCache: boolean = true;
|
|
|
|
export const enableReactTestRendererWarning: boolean = false;
|
|
|
|
export const disableLegacyMode: boolean = true;
|
|
|
|
export const enableEagerAlternateStateNodeCleanup: boolean = true;
|
|
|
|
export const enableGestureTransition: boolean = false;
|
|
|
|
export const enableSuspenseyImages: boolean = false;
|
|
export const enableFizzBlockingRender: boolean = true;
|
|
export const enableSrcObject: boolean = false;
|
|
export const enableHydrationChangeEvent: boolean = false;
|
|
export const enableDefaultTransitionIndicator: boolean = true;
|
|
|
|
export const ownerStackLimit = 1e4;
|
|
|
|
export const enableFragmentRefsInstanceHandles: boolean = true;
|
|
|
|
export const enableOptimisticKey: boolean = false;
|
|
|
|
// Flow magic to verify the exports of this file match the original version.
|
|
((((null: any): ExportsType): FeatureFlagsType): ExportsType);
|