mirror of
https://github.com/facebook/react.git
synced 2026-02-27 03:07:57 +00:00
A long standing issue for React has been that if you reorder stateful nodes, they may lose their state and reload. The thing moving loses its state. There's no way to solve this in general where two stateful nodes swap. The [`moveBefore()` proposal](https://chromestatus.com/feature/5135990159835136?gate=5177450351558656) has now moved to [intent-to-ship](https://groups.google.com/a/chromium.org/g/blink-dev/c/YE_xLH6MkRs/m/_7CD0NYMAAAJ). This function is kind of like `insertBefore` but preserves state. There's [a demo here](https://state-preserving-atomic-move.glitch.me/). Ideally we'd port this demo to a fixture so we can try it. Currently this flag is always off - even in experimental. That's because this is still behind a Chrome flag so it's a little early to turn it on even in experimental. So you need a custom build. It's on in RN but only because it doesn't apply there which makes it easier to tell that it's safe to ship once it's on everywhere else. The other reason it's still off is because there's currently a semantic breaking change. `moveBefore()` errors if both nodes are disconnected. That happens if we're inside a completely disconnected React root. That's not usually how you should use React because it means effects can't read layout etc. However, it is currently supported. To handle this we'd have to try/catch the `moveBefore` to handle this case but we hope this semantic will change before it ships. Before we turn this on in experimental we either have to wait for the implementation to not error in the disconnected-disconnected case in Chrome or we'd have to add try/catch.
98 lines
4.3 KiB
JavaScript
98 lines
4.3 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.native-oss';
|
|
|
|
// TODO: Align these flags with canary and delete this file once RN ships from Canary.
|
|
|
|
// DEV-only but enabled in the next RN Major.
|
|
// Not supported by flag script to avoid the special case.
|
|
export const debugRenderPhaseSideEffectsForStrictMode = __DEV__;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// All other flags
|
|
// -----------------------------------------------------------------------------
|
|
export const alwaysThrottleRetries = false;
|
|
export const consoleManagedByDevToolsDuringStrictMode = true;
|
|
export const disableClientCache = true;
|
|
export const disableCommentsAsDOMContainers = true;
|
|
export const disableDefaultPropsExceptForClasses = true;
|
|
export const disableIEWorkarounds = true;
|
|
export const disableInputAttributeSyncing = false;
|
|
export const disableLegacyContext = true;
|
|
export const disableLegacyContextForFunctionComponents = true;
|
|
export const disableLegacyMode = false;
|
|
export const disableSchedulerTimeoutInWorkLoop = false;
|
|
export const disableTextareaChildren = false;
|
|
export const enableAsyncActions = true;
|
|
export const enableAsyncDebugInfo = false;
|
|
export const enableAsyncIterableChildren = false;
|
|
export const enableBinaryFlight = true;
|
|
export const enableCache = true;
|
|
export const enableComponentStackLocations = true;
|
|
export const enableCPUSuspense = false;
|
|
export const enableCreateEventHandleAPI = false;
|
|
export const enableDebugTracing = false;
|
|
export const enableDeferRootSchedulingToMicrotask = true;
|
|
export const enableDO_NOT_USE_disableStrictPassiveEffect = false;
|
|
export const enableFabricCompleteRootInCommitPhase = false;
|
|
export const enableFilterEmptyStringAttributesDOM = true;
|
|
export const enableMoveBefore = true;
|
|
export const enableFizzExternalRuntime = true;
|
|
export const enableFlightReadableStream = true;
|
|
export const enableGetInspectorDataForInstanceInProduction = false;
|
|
export const enableHalt = false;
|
|
export const enableHiddenSubtreeInsertionEffectCleanup = false;
|
|
export const enableInfiniteRenderLoopDetection = false;
|
|
export const enableLazyContextPropagation = true;
|
|
export const enableContextProfiling = false;
|
|
export const enableLegacyCache = false;
|
|
export const enableLegacyFBSupport = false;
|
|
export const enableLegacyHidden = false;
|
|
export const enableNoCloningMemoCache = false;
|
|
export const enableObjectFiber = false;
|
|
export const enableOwnerStacks = false;
|
|
export const enablePersistedModeClonedFlag = false;
|
|
export const enablePostpone = false;
|
|
export const enableReactTestRendererWarning = false;
|
|
export const enableRenderableContext = true;
|
|
export const enableRetryLaneExpiration = false;
|
|
export const enableSchedulingProfiler = __PROFILE__;
|
|
export const enableComponentPerformanceTrack = false;
|
|
export const enableScopeAPI = false;
|
|
export const enableServerComponentLogs = true;
|
|
export const enableShallowPropDiffing = false;
|
|
export const enableSuspenseAvoidThisFallback = false;
|
|
export const enableSuspenseAvoidThisFallbackFizz = false;
|
|
export const enableSuspenseCallback = false;
|
|
export const enableTaint = true;
|
|
export const enableTransitionTracing = false;
|
|
export const enableTrustedTypesIntegration = false;
|
|
export const enableUseEffectEventHook = false;
|
|
export const enableUseMemoCacheHook = true;
|
|
export const favorSafetyOverHydrationPerf = true;
|
|
export const passChildrenWhenCloningPersistedNodes = false;
|
|
export const renameElementSymbol = true;
|
|
export const retryLaneExpirationMs = 5000;
|
|
export const syncLaneExpirationMs = 250;
|
|
export const transitionLaneExpirationMs = 5000;
|
|
export const useModernStrictMode = true;
|
|
export const enableSiblingPrerendering = true;
|
|
export const enableUseResourceEffectHook = false;
|
|
|
|
// Profiling Only
|
|
export const enableProfilerTimer = __PROFILE__;
|
|
export const enableProfilerCommitHooks = __PROFILE__;
|
|
export const enableProfilerNestedUpdatePhase = __PROFILE__;
|
|
export const enableUpdaterTracking = __PROFILE__;
|
|
|
|
// Flow magic to verify the exports of this file match the original version.
|
|
((((null: any): ExportsType): FeatureFlagsType): ExportsType);
|