From e06c72fcf4632ad3117add713a25f6354631f037 Mon Sep 17 00:00:00 2001 From: Ricky Date: Sun, 15 Dec 2024 12:34:08 -0500 Subject: [PATCH] [flags] Cleanup enableCache (#31778) This is landed everywhere --- .../__tests__/ReactCompositeComponent-test.js | 15 +- .../src/__tests__/ReactMarkupServer-test.js | 1 - .../src/ReactFiberAsyncDispatcher.js | 4 - .../src/ReactFiberBeginWork.js | 121 +++++------ .../src/ReactFiberCacheComponent.js | 52 ++--- .../src/ReactFiberCommitWork.js | 189 ++++++++---------- .../src/ReactFiberCompleteWork.js | 83 ++++---- .../react-reconciler/src/ReactFiberHooks.js | 111 ++++------ .../react-reconciler/src/ReactFiberRoot.js | 52 ++--- .../src/ReactFiberTransition.js | 27 +-- .../src/ReactFiberUnwindWork.js | 25 +-- .../src/ReactFiberWorkLoop.js | 33 ++- .../src/__tests__/ReactCache-test.js | 3 - packages/react-server/src/ReactFizzHooks.js | 5 +- packages/react-server/src/ReactFizzServer.js | 12 +- packages/shared/ReactFeatureFlags.js | 1 - .../forks/ReactFeatureFlags.native-fb.js | 1 - .../forks/ReactFeatureFlags.native-oss.js | 1 - .../forks/ReactFeatureFlags.test-renderer.js | 1 - ...actFeatureFlags.test-renderer.native-fb.js | 1 - .../ReactFeatureFlags.test-renderer.www.js | 1 - .../shared/forks/ReactFeatureFlags.www.js | 1 - 22 files changed, 282 insertions(+), 458 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js index 4444076681208..30b5ced5cf2e3 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js @@ -537,7 +537,6 @@ describe('ReactCompositeComponent', () => { }); it('should cleanup even if render() fatals', async () => { - const dispatcherEnabled = __DEV__ || gate(flags => flags.enableCache); const ownerEnabled = __DEV__; let stashedDispatcher; @@ -551,7 +550,7 @@ describe('ReactCompositeComponent', () => { } const instance = ; - expect(ReactSharedInternals.A).toBe(dispatcherEnabled ? null : undefined); + expect(ReactSharedInternals.A).toBe(null); const root = ReactDOMClient.createRoot(document.createElement('div')); await expect(async () => { @@ -560,15 +559,11 @@ describe('ReactCompositeComponent', () => { }); }).rejects.toThrow(); - expect(ReactSharedInternals.A).toBe(dispatcherEnabled ? null : undefined); - if (dispatcherEnabled) { - if (ownerEnabled) { - expect(stashedDispatcher.getOwner()).toBe(null); - } else { - expect(stashedDispatcher.getOwner).toBe(undefined); - } + expect(ReactSharedInternals.A).toBe(null); + if (ownerEnabled) { + expect(stashedDispatcher.getOwner()).toBe(null); } else { - expect(stashedDispatcher).toBe(undefined); + expect(stashedDispatcher.getOwner).toBe(undefined); } }); diff --git a/packages/react-markup/src/__tests__/ReactMarkupServer-test.js b/packages/react-markup/src/__tests__/ReactMarkupServer-test.js index 1e0cce3c9a150..afd6ea5df8f26 100644 --- a/packages/react-markup/src/__tests__/ReactMarkupServer-test.js +++ b/packages/react-markup/src/__tests__/ReactMarkupServer-test.js @@ -209,7 +209,6 @@ if (!__EXPERIMENTAL__) { ); }); - // @gate enableCache it('supports cache', async () => { let counter = 0; const getCount = React.cache(() => { diff --git a/packages/react-reconciler/src/ReactFiberAsyncDispatcher.js b/packages/react-reconciler/src/ReactFiberAsyncDispatcher.js index 0d6856f5d0ac1..4ff65fb90011a 100644 --- a/packages/react-reconciler/src/ReactFiberAsyncDispatcher.js +++ b/packages/react-reconciler/src/ReactFiberAsyncDispatcher.js @@ -10,16 +10,12 @@ import type {AsyncDispatcher, Fiber} from './ReactInternalTypes'; import type {Cache} from './ReactFiberCacheComponent'; -import {enableCache} from 'shared/ReactFeatureFlags'; import {readContext} from './ReactFiberNewContext'; import {CacheContext} from './ReactFiberCacheComponent'; import {current as currentOwner} from './ReactCurrentFiber'; function getCacheForType(resourceType: () => T): T { - if (!enableCache) { - throw new Error('Not implemented.'); - } const cache: Cache = readContext(CacheContext); let cacheForType: T | void = (cache.data.get(resourceType): any); if (cacheForType === undefined) { diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.js b/packages/react-reconciler/src/ReactFiberBeginWork.js index 0ae0e668d22ac..2d3e3c04c48ea 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.js @@ -100,7 +100,6 @@ import { enableProfilerCommitHooks, enableProfilerTimer, enableScopeAPI, - enableCache, enableLazyContextPropagation, enableSchedulingProfiler, enableTransitionTracing, @@ -714,12 +713,10 @@ function updateOffscreenComponent( cachePool: null, }; workInProgress.memoizedState = nextState; - if (enableCache) { - // push the cache pool even though we're going to bail out - // because otherwise there'd be a context mismatch - if (current !== null) { - pushTransition(workInProgress, null, null); - } + // push the cache pool even though we're going to bail out + // because otherwise there'd be a context mismatch + if (current !== null) { + pushTransition(workInProgress, null, null); } reuseHiddenContextOnStack(workInProgress); pushOffscreenSuspenseHandler(workInProgress); @@ -753,7 +750,7 @@ function updateOffscreenComponent( cachePool: null, }; workInProgress.memoizedState = nextState; - if (enableCache && current !== null) { + if (current !== null) { // If the render that spawned this one accessed the cache pool, resume // using the same cache. Unless the parent changed, since that means // there was a refresh. @@ -776,12 +773,10 @@ function updateOffscreenComponent( if (prevState !== null) { // We're going from hidden -> visible. let prevCachePool = null; - if (enableCache) { - // If the render that spawned this one accessed the cache pool, resume - // using the same cache. Unless the parent changed, since that means - // there was a refresh. - prevCachePool = prevState.cachePool; - } + // If the render that spawned this one accessed the cache pool, resume + // using the same cache. Unless the parent changed, since that means + // there was a refresh. + prevCachePool = prevState.cachePool; let transitions = null; if (enableTransitionTracing) { @@ -806,13 +801,11 @@ function updateOffscreenComponent( // special to do. Need to push to the stack regardless, though, to avoid // a push/pop misalignment. - if (enableCache) { - // If the render that spawned this one accessed the cache pool, resume - // using the same cache. Unless the parent changed, since that means - // there was a refresh. - if (current !== null) { - pushTransition(workInProgress, null, null); - } + // If the render that spawned this one accessed the cache pool, resume + // using the same cache. Unless the parent changed, since that means + // there was a refresh. + if (current !== null) { + pushTransition(workInProgress, null, null); } // We're about to bail out, but we need to push this to the stack anyway @@ -835,15 +828,13 @@ function deferHiddenOffscreenComponent( const nextState: OffscreenState = { baseLanes: nextBaseLanes, // Save the cache pool so we can resume later. - cachePool: enableCache ? getOffscreenDeferredCache() : null, + cachePool: getOffscreenDeferredCache(), }; workInProgress.memoizedState = nextState; - if (enableCache) { - // push the cache pool even though we're going to bail out - // because otherwise there'd be a context mismatch - if (current !== null) { - pushTransition(workInProgress, null, null); - } + // push the cache pool even though we're going to bail out + // because otherwise there'd be a context mismatch + if (current !== null) { + pushTransition(workInProgress, null, null); } // We're about to bail out, but we need to push this to the stack anyway @@ -876,10 +867,6 @@ function updateCacheComponent( workInProgress: Fiber, renderLanes: Lanes, ) { - if (!enableCache) { - return null; - } - prepareToReadContext(workInProgress, renderLanes); const parentCache = readContext(CacheContext); @@ -1480,13 +1467,11 @@ function updateHostRoot( pushRootMarkerInstance(workInProgress); } - if (enableCache) { - const nextCache: Cache = nextState.cache; - pushCacheProvider(workInProgress, nextCache); - if (nextCache !== prevState.cache) { - // The root cache refreshed. - propagateContextChange(workInProgress, CacheContext, renderLanes); - } + const nextCache: Cache = nextState.cache; + pushCacheProvider(workInProgress, nextCache); + if (nextCache !== prevState.cache) { + // The root cache refreshed. + propagateContextChange(workInProgress, CacheContext, renderLanes); } // This would ideally go inside processUpdateQueue, but because it suspends, @@ -1990,28 +1975,26 @@ function updateSuspenseOffscreenState( renderLanes: Lanes, ): OffscreenState { let cachePool: SpawnedCachePool | null = null; - if (enableCache) { - const prevCachePool: SpawnedCachePool | null = prevOffscreenState.cachePool; - if (prevCachePool !== null) { - const parentCache = isPrimaryRenderer - ? CacheContext._currentValue - : CacheContext._currentValue2; - if (prevCachePool.parent !== parentCache) { - // Detected a refresh in the parent. This overrides any previously - // suspended cache. - cachePool = { - parent: parentCache, - pool: parentCache, - }; - } else { - // We can reuse the cache from last time. The only thing that would have - // overridden it is a parent refresh, which we checked for above. - cachePool = prevCachePool; - } + const prevCachePool: SpawnedCachePool | null = prevOffscreenState.cachePool; + if (prevCachePool !== null) { + const parentCache = isPrimaryRenderer + ? CacheContext._currentValue + : CacheContext._currentValue2; + if (prevCachePool.parent !== parentCache) { + // Detected a refresh in the parent. This overrides any previously + // suspended cache. + cachePool = { + parent: parentCache, + pool: parentCache, + }; } else { - // If there's no previous cache pool, grab the current one. - cachePool = getSuspendedCache(); + // We can reuse the cache from last time. The only thing that would have + // overridden it is a parent refresh, which we checked for above. + cachePool = prevCachePool; } + } else { + // If there's no previous cache pool, grab the current one. + cachePool = getSuspendedCache(); } return { baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes), @@ -3599,7 +3582,7 @@ function attemptEarlyBailoutIfNoScheduledUpdate( // the begin phase. There's still some bookkeeping we that needs to be done // in this optimized path, mostly pushing stuff onto the stack. switch (workInProgress.tag) { - case HostRoot: + case HostRoot: { pushHostRootContext(workInProgress); const root: FiberRoot = workInProgress.stateNode; pushRootTransition(workInProgress, root, renderLanes); @@ -3608,12 +3591,11 @@ function attemptEarlyBailoutIfNoScheduledUpdate( pushRootMarkerInstance(workInProgress); } - if (enableCache) { - const cache: Cache = current.memoizedState.cache; - pushCacheProvider(workInProgress, cache); - } + const cache: Cache = current.memoizedState.cache; + pushCacheProvider(workInProgress, cache); resetHydrationState(); break; + } case HostSingleton: case HostComponent: pushHostContext(workInProgress); @@ -3795,10 +3777,8 @@ function attemptEarlyBailoutIfNoScheduledUpdate( return updateOffscreenComponent(current, workInProgress, renderLanes); } case CacheComponent: { - if (enableCache) { - const cache: Cache = current.memoizedState.cache; - pushCacheProvider(workInProgress, cache); - } + const cache: Cache = current.memoizedState.cache; + pushCacheProvider(workInProgress, cache); break; } case TracingMarkerComponent: { @@ -4085,10 +4065,7 @@ function beginWork( break; } case CacheComponent: { - if (enableCache) { - return updateCacheComponent(current, workInProgress, renderLanes); - } - break; + return updateCacheComponent(current, workInProgress, renderLanes); } case TracingMarkerComponent: { if (enableTransitionTracing) { diff --git a/packages/react-reconciler/src/ReactFiberCacheComponent.js b/packages/react-reconciler/src/ReactFiberCacheComponent.js index 64269c5785d13..c7e0c1a11d783 100644 --- a/packages/react-reconciler/src/ReactFiberCacheComponent.js +++ b/packages/react-reconciler/src/ReactFiberCacheComponent.js @@ -10,7 +10,6 @@ import type {ReactContext} from 'shared/ReactTypes'; import type {Fiber} from 'react-reconciler/src/ReactInternalTypes'; -import {enableCache} from 'shared/ReactFeatureFlags'; import {REACT_CONTEXT_TYPE} from 'shared/ReactSymbols'; import {pushProvider, popProvider} from './ReactFiberNewContext'; @@ -18,8 +17,8 @@ import * as Scheduler from 'scheduler'; // In environments without AbortController (e.g. tests) // replace it with a lightweight shim that only has the features we use. -const AbortControllerLocal: typeof AbortController = enableCache - ? typeof AbortController !== 'undefined' +const AbortControllerLocal: typeof AbortController = + typeof AbortController !== 'undefined' ? AbortController : // $FlowFixMe[missing-this-annot] // $FlowFixMe[prop-missing] @@ -36,9 +35,7 @@ const AbortControllerLocal: typeof AbortController = enableCache signal.aborted = true; listeners.forEach(listener => listener()); }; - } - : // $FlowFixMe[incompatible-type] - null; + }; export type Cache = { controller: AbortController, @@ -63,20 +60,18 @@ const { unstable_NormalPriority: NormalPriority, } = Scheduler; -export const CacheContext: ReactContext = enableCache - ? { - $$typeof: REACT_CONTEXT_TYPE, - // We don't use Consumer/Provider for Cache components. So we'll cheat. - Consumer: (null: any), - Provider: (null: any), - // We'll initialize these at the root. - _currentValue: (null: any), - _currentValue2: (null: any), - _threadCount: 0, - } - : (null: any); +export const CacheContext: ReactContext = { + $$typeof: REACT_CONTEXT_TYPE, + // We don't use Consumer/Provider for Cache components. So we'll cheat. + Consumer: (null: any), + Provider: (null: any), + // We'll initialize these at the root. + _currentValue: (null: any), + _currentValue2: (null: any), + _threadCount: 0, +}; -if (__DEV__ && enableCache) { +if (__DEV__) { CacheContext._currentRenderer = null; CacheContext._currentRenderer2 = null; } @@ -85,22 +80,14 @@ if (__DEV__ && enableCache) { // for retaining the cache once it is in use (retainCache), and releasing the cache // once it is no longer needed (releaseCache). export function createCache(): Cache { - if (!enableCache) { - return (null: any); - } - const cache: Cache = { + return { controller: new AbortControllerLocal(), data: new Map(), refCount: 0, }; - - return cache; } export function retainCache(cache: Cache) { - if (!enableCache) { - return; - } if (__DEV__) { if (cache.controller.signal.aborted) { console.warn( @@ -114,9 +101,6 @@ export function retainCache(cache: Cache) { // Cleanup a cache instance, potentially freeing it if there are no more references export function releaseCache(cache: Cache) { - if (!enableCache) { - return; - } cache.refCount--; if (__DEV__) { if (cache.refCount < 0) { @@ -134,15 +118,9 @@ export function releaseCache(cache: Cache) { } export function pushCacheProvider(workInProgress: Fiber, cache: Cache) { - if (!enableCache) { - return; - } pushProvider(workInProgress, CacheContext, cache); } export function popCacheProvider(workInProgress: Fiber, cache: Cache) { - if (!enableCache) { - return; - } popProvider(CacheContext, workInProgress); } diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index 7887be44e46c0..df16eb96ef216 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -47,7 +47,6 @@ import { enableSuspenseCallback, enableScopeAPI, enableUpdaterTracking, - enableCache, enableTransitionTracing, enableUseEffectEventHook, enableLegacyHidden, @@ -2455,33 +2454,31 @@ function commitOffscreenPassiveMountEffects( finishedWork: Fiber, instance: OffscreenInstance, ) { - if (enableCache) { - let previousCache: Cache | null = null; - if ( - current !== null && - current.memoizedState !== null && - current.memoizedState.cachePool !== null - ) { - previousCache = current.memoizedState.cachePool.pool; - } - let nextCache: Cache | null = null; - if ( - finishedWork.memoizedState !== null && - finishedWork.memoizedState.cachePool !== null - ) { - nextCache = finishedWork.memoizedState.cachePool.pool; + let previousCache: Cache | null = null; + if ( + current !== null && + current.memoizedState !== null && + current.memoizedState.cachePool !== null + ) { + previousCache = current.memoizedState.cachePool.pool; + } + let nextCache: Cache | null = null; + if ( + finishedWork.memoizedState !== null && + finishedWork.memoizedState.cachePool !== null + ) { + nextCache = finishedWork.memoizedState.cachePool.pool; + } + // Retain/release the cache used for pending (suspended) nodes. + // Note that this is only reached in the non-suspended/visible case: + // when the content is suspended/hidden, the retain/release occurs + // via the parent Suspense component (see case above). + if (nextCache !== previousCache) { + if (nextCache != null) { + retainCache(nextCache); } - // Retain/release the cache used for pending (suspended) nodes. - // Note that this is only reached in the non-suspended/visible case: - // when the content is suspended/hidden, the retain/release occurs - // via the parent Suspense component (see case above). - if (nextCache !== previousCache) { - if (nextCache != null) { - retainCache(nextCache); - } - if (previousCache != null) { - releaseCache(previousCache); - } + if (previousCache != null) { + releaseCache(previousCache); } } @@ -2552,22 +2549,20 @@ function commitCachePassiveMountEffect( current: Fiber | null, finishedWork: Fiber, ) { - if (enableCache) { - let previousCache: Cache | null = null; - if (finishedWork.alternate !== null) { - previousCache = finishedWork.alternate.memoizedState.cache; - } - const nextCache = finishedWork.memoizedState.cache; - // Retain/release the cache. In theory the cache component - // could be "borrowing" a cache instance owned by some parent, - // in which case we could avoid retaining/releasing. But it - // is non-trivial to determine when that is the case, so we - // always retain/release. - if (nextCache !== previousCache) { - retainCache(nextCache); - if (previousCache != null) { - releaseCache(previousCache); - } + let previousCache: Cache | null = null; + if (finishedWork.alternate !== null) { + previousCache = finishedWork.alternate.memoizedState.cache; + } + const nextCache = finishedWork.memoizedState.cache; + // Retain/release the cache. In theory the cache component + // could be "borrowing" a cache instance owned by some parent, + // in which case we could avoid retaining/releasing. But it + // is non-trivial to determine when that is the case, so we + // always retain/release. + if (nextCache !== previousCache) { + retainCache(nextCache); + if (previousCache != null) { + releaseCache(previousCache); } } } @@ -2712,23 +2707,21 @@ function commitPassiveMountOnFiber( endTime, ); if (flags & Passive) { - if (enableCache) { - let previousCache: Cache | null = null; - if (finishedWork.alternate !== null) { - previousCache = finishedWork.alternate.memoizedState.cache; - } - const nextCache = finishedWork.memoizedState.cache; - // Retain/release the root cache. - // Note that on initial mount, previousCache and nextCache will be the same - // and this retain won't occur. To counter this, we instead retain the HostRoot's - // initial cache when creating the root itself (see createFiberRoot() in - // ReactFiberRoot.js). Subsequent updates that change the cache are reflected - // here, such that previous/next caches are retained correctly. - if (nextCache !== previousCache) { - retainCache(nextCache); - if (previousCache != null) { - releaseCache(previousCache); - } + let previousCache: Cache | null = null; + if (finishedWork.alternate !== null) { + previousCache = finishedWork.alternate.memoizedState.cache; + } + const nextCache = finishedWork.memoizedState.cache; + // Retain/release the root cache. + // Note that on initial mount, previousCache and nextCache will be the same + // and this retain won't occur. To counter this, we instead retain the HostRoot's + // initial cache when creating the root itself (see createFiberRoot() in + // ReactFiberRoot.js). Subsequent updates that change the cache are reflected + // here, such that previous/next caches are retained correctly. + if (nextCache !== previousCache) { + retainCache(nextCache); + if (previousCache != null) { + releaseCache(previousCache); } } @@ -2845,17 +2838,15 @@ function commitPassiveMountOnFiber( if (disableLegacyMode || finishedWork.mode & ConcurrentMode) { // The effects are currently disconnected. Since the tree is hidden, // don't connect them. This also applies to the initial render. - if (enableCache || enableTransitionTracing) { - // "Atomic" effects are ones that need to fire on every commit, - // even during pre-rendering. An example is updating the reference - // count on cache instances. - recursivelyTraverseAtomicPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - ); - } + // "Atomic" effects are ones that need to fire on every commit, + // even during pre-rendering. An example is updating the reference + // count on cache instances. + recursivelyTraverseAtomicPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + ); } else { // Legacy Mode: Fire the effects even if the tree is hidden. instance._visibility |= OffscreenPassiveEffectsConnected; @@ -3065,17 +3056,15 @@ export function reconnectPassiveEffects( if (disableLegacyMode || finishedWork.mode & ConcurrentMode) { // The effects are currently disconnected. Since the tree is hidden, // don't connect them. This also applies to the initial render. - if (enableCache || enableTransitionTracing) { - // "Atomic" effects are ones that need to fire on every commit, - // even during pre-rendering. An example is updating the reference - // count on cache instances. - recursivelyTraverseAtomicPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - ); - } + // "Atomic" effects are ones that need to fire on every commit, + // even during pre-rendering. An example is updating the reference + // count on cache instances. + recursivelyTraverseAtomicPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + ); } else { // Legacy Mode: Fire the effects even if the tree is hidden. instance._visibility |= OffscreenPassiveEffectsConnected; @@ -3618,27 +3607,23 @@ function commitPassiveUnmountInsideDeletedTreeOnFiber( // the cache instance owned by the root will never be freed. // When effects are run, the cache should be freed here: // case HostRoot: { - // if (enableCache) { - // const cache = current.memoizedState.cache; - // releaseCache(cache); - // } + // const cache = current.memoizedState.cache; + // releaseCache(cache); // break; // } case LegacyHiddenComponent: case OffscreenComponent: { - if (enableCache) { - if ( - current.memoizedState !== null && - current.memoizedState.cachePool !== null - ) { - const cache: Cache = current.memoizedState.cachePool.pool; - // Retain/release the cache used for pending (suspended) nodes. - // Note that this is only reached in the non-suspended/visible case: - // when the content is suspended/hidden, the retain/release occurs - // via the parent Suspense component (see case above). - if (cache != null) { - retainCache(cache); - } + if ( + current.memoizedState !== null && + current.memoizedState.cachePool !== null + ) { + const cache: Cache = current.memoizedState.cachePool.pool; + // Retain/release the cache used for pending (suspended) nodes. + // Note that this is only reached in the non-suspended/visible case: + // when the content is suspended/hidden, the retain/release occurs + // via the parent Suspense component (see case above). + if (cache != null) { + retainCache(cache); } } break; @@ -3681,10 +3666,8 @@ function commitPassiveUnmountInsideDeletedTreeOnFiber( break; } case CacheComponent: { - if (enableCache) { - const cache = current.memoizedState.cache; - releaseCache(cache); - } + const cache = current.memoizedState.cache; + releaseCache(cache); break; } case TracingMarkerComponent: { diff --git a/packages/react-reconciler/src/ReactFiberCompleteWork.js b/packages/react-reconciler/src/ReactFiberCompleteWork.js index b24351ac383b9..b302b498fa14d 100644 --- a/packages/react-reconciler/src/ReactFiberCompleteWork.js +++ b/packages/react-reconciler/src/ReactFiberCompleteWork.js @@ -37,7 +37,6 @@ import { enableScopeAPI, enablePersistedModeClonedFlag, enableProfilerTimer, - enableCache, enableTransitionTracing, enableRenderableContext, passChildrenWhenCloningPersistedNodes, @@ -985,18 +984,16 @@ function completeWork( } } - if (enableCache) { - let previousCache: Cache | null = null; - if (current !== null) { - previousCache = current.memoizedState.cache; - } - const cache: Cache = workInProgress.memoizedState.cache; - if (cache !== previousCache) { - // Run passive effects to retain/release the cache. - workInProgress.flags |= Passive; - } - popCacheProvider(workInProgress, cache); + let previousCache: Cache | null = null; + if (current !== null) { + previousCache = current.memoizedState.cache; + } + const cache: Cache = workInProgress.memoizedState.cache; + if (cache !== previousCache) { + // Run passive effects to retain/release the cache. + workInProgress.flags |= Passive; } + popCacheProvider(workInProgress, cache); if (enableTransitionTracing) { popRootMarkerInstance(workInProgress); @@ -1384,7 +1381,7 @@ function completeWork( current !== null && (current.memoizedState: null | SuspenseState) !== null; - if (enableCache && nextDidTimeout) { + if (nextDidTimeout) { const offscreenFiber: Fiber = (workInProgress.child: any); let previousCache: Cache | null = null; if ( @@ -1783,26 +1780,24 @@ function completeWork( scheduleRetryEffect(workInProgress, retryQueue); } - if (enableCache) { - let previousCache: Cache | null = null; - if ( - current !== null && - current.memoizedState !== null && - current.memoizedState.cachePool !== null - ) { - previousCache = current.memoizedState.cachePool.pool; - } - let cache: Cache | null = null; - if ( - workInProgress.memoizedState !== null && - workInProgress.memoizedState.cachePool !== null - ) { - cache = workInProgress.memoizedState.cachePool.pool; - } - if (cache !== previousCache) { - // Run passive effects to retain/release the cache. - workInProgress.flags |= Passive; - } + let previousCache: Cache | null = null; + if ( + current !== null && + current.memoizedState !== null && + current.memoizedState.cachePool !== null + ) { + previousCache = current.memoizedState.cachePool.pool; + } + let cache: Cache | null = null; + if ( + workInProgress.memoizedState !== null && + workInProgress.memoizedState.cachePool !== null + ) { + cache = workInProgress.memoizedState.cachePool.pool; + } + if (cache !== previousCache) { + // Run passive effects to retain/release the cache. + workInProgress.flags |= Passive; } popTransition(workInProgress, current); @@ -1810,19 +1805,17 @@ function completeWork( return null; } case CacheComponent: { - if (enableCache) { - let previousCache: Cache | null = null; - if (current !== null) { - previousCache = current.memoizedState.cache; - } - const cache: Cache = workInProgress.memoizedState.cache; - if (cache !== previousCache) { - // Run passive effects to retain/release the cache. - workInProgress.flags |= Passive; - } - popCacheProvider(workInProgress, cache); - bubbleProperties(workInProgress); + let previousCache: Cache | null = null; + if (current !== null) { + previousCache = current.memoizedState.cache; } + const cache: Cache = workInProgress.memoizedState.cache; + if (cache !== previousCache) { + // Run passive effects to retain/release the cache. + workInProgress.flags |= Passive; + } + popCacheProvider(workInProgress, cache); + bubbleProperties(workInProgress); return null; } case TracingMarkerComponent: { diff --git a/packages/react-reconciler/src/ReactFiberHooks.js b/packages/react-reconciler/src/ReactFiberHooks.js index 11851d213b0fb..8affe4804b8ab 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.js +++ b/packages/react-reconciler/src/ReactFiberHooks.js @@ -36,7 +36,6 @@ import { import ReactSharedInternals from 'shared/ReactSharedInternals'; import { enableSchedulingProfiler, - enableCache, enableLazyContextPropagation, enableTransitionTracing, enableUseEffectEventHook, @@ -3591,9 +3590,6 @@ function updateRefresh(): any { } function refreshCache(fiber: Fiber, seedKey: ?() => T, seedValue: T): void { - if (!enableCache) { - return; - } // TODO: Does Cache work in legacy mode? Should decide and write a test. // TODO: Consider warning if the refresh is at discrete priority, or if we // otherwise suspect that it wasn't batched properly. @@ -3954,10 +3950,8 @@ export const ContextOnlyDispatcher: Dispatcher = { useActionState: throwInvalidHookError, useOptimistic: throwInvalidHookError, useMemoCache: throwInvalidHookError, + useCacheRefresh: throwInvalidHookError, }; -if (enableCache) { - (ContextOnlyDispatcher: Dispatcher).useCacheRefresh = throwInvalidHookError; -} if (enableUseEffectEventHook) { (ContextOnlyDispatcher: Dispatcher).useEffectEvent = throwInvalidHookError; } @@ -3993,10 +3987,8 @@ const HooksDispatcherOnMount: Dispatcher = { useActionState: mountActionState, useOptimistic: mountOptimistic, useMemoCache, + useCacheRefresh: mountRefresh, }; -if (enableCache) { - (HooksDispatcherOnMount: Dispatcher).useCacheRefresh = mountRefresh; -} if (enableUseEffectEventHook) { (HooksDispatcherOnMount: Dispatcher).useEffectEvent = mountEvent; } @@ -4032,10 +4024,8 @@ const HooksDispatcherOnUpdate: Dispatcher = { useActionState: updateActionState, useOptimistic: updateOptimistic, useMemoCache, + useCacheRefresh: updateRefresh, }; -if (enableCache) { - (HooksDispatcherOnUpdate: Dispatcher).useCacheRefresh = updateRefresh; -} if (enableUseEffectEventHook) { (HooksDispatcherOnUpdate: Dispatcher).useEffectEvent = updateEvent; } @@ -4072,10 +4062,8 @@ const HooksDispatcherOnRerender: Dispatcher = { useActionState: rerenderActionState, useOptimistic: rerenderOptimistic, useMemoCache, + useCacheRefresh: updateRefresh, }; -if (enableCache) { - (HooksDispatcherOnRerender: Dispatcher).useCacheRefresh = updateRefresh; -} if (enableUseEffectEventHook) { (HooksDispatcherOnRerender: Dispatcher).useEffectEvent = updateEvent; } @@ -4271,15 +4259,12 @@ if (__DEV__) { }, useHostTransitionStatus, useMemoCache, + useCacheRefresh() { + currentHookNameInDev = 'useCacheRefresh'; + mountHookTypesDev(); + return mountRefresh(); + }, }; - if (enableCache) { - (HooksDispatcherOnMountInDEV: Dispatcher).useCacheRefresh = - function useCacheRefresh() { - currentHookNameInDev = 'useCacheRefresh'; - mountHookTypesDev(); - return mountRefresh(); - }; - } if (enableUseEffectEventHook) { (HooksDispatcherOnMountInDEV: Dispatcher).useEffectEvent = function useEffectEvent) => Return>( @@ -4473,15 +4458,12 @@ if (__DEV__) { }, useHostTransitionStatus, useMemoCache, + useCacheRefresh() { + currentHookNameInDev = 'useCacheRefresh'; + updateHookTypesDev(); + return mountRefresh(); + }, }; - if (enableCache) { - (HooksDispatcherOnMountWithHookTypesInDEV: Dispatcher).useCacheRefresh = - function useCacheRefresh() { - currentHookNameInDev = 'useCacheRefresh'; - updateHookTypesDev(); - return mountRefresh(); - }; - } if (enableUseEffectEventHook) { (HooksDispatcherOnMountWithHookTypesInDEV: Dispatcher).useEffectEvent = function useEffectEvent) => Return>( @@ -4674,15 +4656,12 @@ if (__DEV__) { }, useHostTransitionStatus, useMemoCache, + useCacheRefresh() { + currentHookNameInDev = 'useCacheRefresh'; + updateHookTypesDev(); + return updateRefresh(); + }, }; - if (enableCache) { - (HooksDispatcherOnUpdateInDEV: Dispatcher).useCacheRefresh = - function useCacheRefresh() { - currentHookNameInDev = 'useCacheRefresh'; - updateHookTypesDev(); - return updateRefresh(); - }; - } if (enableUseEffectEventHook) { (HooksDispatcherOnUpdateInDEV: Dispatcher).useEffectEvent = function useEffectEvent) => Return>( @@ -4875,15 +4854,12 @@ if (__DEV__) { }, useHostTransitionStatus, useMemoCache, + useCacheRefresh() { + currentHookNameInDev = 'useCacheRefresh'; + updateHookTypesDev(); + return updateRefresh(); + }, }; - if (enableCache) { - (HooksDispatcherOnRerenderInDEV: Dispatcher).useCacheRefresh = - function useCacheRefresh() { - currentHookNameInDev = 'useCacheRefresh'; - updateHookTypesDev(); - return updateRefresh(); - }; - } if (enableUseEffectEventHook) { (HooksDispatcherOnRerenderInDEV: Dispatcher).useEffectEvent = function useEffectEvent) => Return>( @@ -5100,15 +5076,12 @@ if (__DEV__) { return useMemoCache(size); }, useHostTransitionStatus, + useCacheRefresh() { + currentHookNameInDev = 'useCacheRefresh'; + mountHookTypesDev(); + return mountRefresh(); + }, }; - if (enableCache) { - (InvalidNestedHooksDispatcherOnMountInDEV: Dispatcher).useCacheRefresh = - function useCacheRefresh() { - currentHookNameInDev = 'useCacheRefresh'; - mountHookTypesDev(); - return mountRefresh(); - }; - } if (enableUseEffectEventHook) { (InvalidNestedHooksDispatcherOnMountInDEV: Dispatcher).useEffectEvent = function useEffectEvent) => Return>( @@ -5328,15 +5301,12 @@ if (__DEV__) { return useMemoCache(size); }, useHostTransitionStatus, + useCacheRefresh() { + currentHookNameInDev = 'useCacheRefresh'; + updateHookTypesDev(); + return updateRefresh(); + }, }; - if (enableCache) { - (InvalidNestedHooksDispatcherOnUpdateInDEV: Dispatcher).useCacheRefresh = - function useCacheRefresh() { - currentHookNameInDev = 'useCacheRefresh'; - updateHookTypesDev(); - return updateRefresh(); - }; - } if (enableUseEffectEventHook) { (InvalidNestedHooksDispatcherOnUpdateInDEV: Dispatcher).useEffectEvent = function useEffectEvent) => Return>( @@ -5556,15 +5526,12 @@ if (__DEV__) { return useMemoCache(size); }, useHostTransitionStatus, + useCacheRefresh() { + currentHookNameInDev = 'useCacheRefresh'; + updateHookTypesDev(); + return updateRefresh(); + }, }; - if (enableCache) { - (InvalidNestedHooksDispatcherOnRerenderInDEV: Dispatcher).useCacheRefresh = - function useCacheRefresh() { - currentHookNameInDev = 'useCacheRefresh'; - updateHookTypesDev(); - return updateRefresh(); - }; - } if (enableUseEffectEventHook) { (InvalidNestedHooksDispatcherOnRerenderInDEV: Dispatcher).useEffectEvent = function useEffectEvent) => Return>( diff --git a/packages/react-reconciler/src/ReactFiberRoot.js b/packages/react-reconciler/src/ReactFiberRoot.js index 176c3846d1336..29bc7923d893e 100644 --- a/packages/react-reconciler/src/ReactFiberRoot.js +++ b/packages/react-reconciler/src/ReactFiberRoot.js @@ -28,7 +28,6 @@ import { } from './ReactFiberLane'; import { enableSuspenseCallback, - enableCache, enableProfilerCommitHooks, enableProfilerTimer, enableUpdaterTracking, @@ -91,10 +90,8 @@ function FiberRootNode( this.onCaughtError = onCaughtError; this.onRecoverableError = onRecoverableError; - if (enableCache) { - this.pooledCache = null; - this.pooledCacheLanes = NoLanes; - } + this.pooledCache = null; + this.pooledCacheLanes = NoLanes; if (enableSuspenseCallback) { this.hydrationCallbacks = null; @@ -196,33 +193,24 @@ export function createFiberRoot( root.current = uninitializedFiber; uninitializedFiber.stateNode = root; - if (enableCache) { - const initialCache = createCache(); - retainCache(initialCache); - - // The pooledCache is a fresh cache instance that is used temporarily - // for newly mounted boundaries during a render. In general, the - // pooledCache is always cleared from the root at the end of a render: - // it is either released when render commits, or moved to an Offscreen - // component if rendering suspends. Because the lifetime of the pooled - // cache is distinct from the main memoizedState.cache, it must be - // retained separately. - root.pooledCache = initialCache; - retainCache(initialCache); - const initialState: RootState = { - element: initialChildren, - isDehydrated: hydrate, - cache: initialCache, - }; - uninitializedFiber.memoizedState = initialState; - } else { - const initialState: RootState = { - element: initialChildren, - isDehydrated: hydrate, - cache: (null: any), // not enabled yet - }; - uninitializedFiber.memoizedState = initialState; - } + const initialCache = createCache(); + retainCache(initialCache); + + // The pooledCache is a fresh cache instance that is used temporarily + // for newly mounted boundaries during a render. In general, the + // pooledCache is always cleared from the root at the end of a render: + // it is either released when render commits, or moved to an Offscreen + // component if rendering suspends. Because the lifetime of the pooled + // cache is distinct from the main memoizedState.cache, it must be + // retained separately. + root.pooledCache = initialCache; + retainCache(initialCache); + const initialState: RootState = { + element: initialChildren, + isDehydrated: hydrate, + cache: initialCache, + }; + uninitializedFiber.memoizedState = initialState; initializeUpdateQueue(uninitializedFiber); diff --git a/packages/react-reconciler/src/ReactFiberTransition.js b/packages/react-reconciler/src/ReactFiberTransition.js index 8953ca1457271..db4db589084f1 100644 --- a/packages/react-reconciler/src/ReactFiberTransition.js +++ b/packages/react-reconciler/src/ReactFiberTransition.js @@ -16,7 +16,7 @@ import type { Transition, } from './ReactFiberTracingMarkerComponent'; -import {enableCache, enableTransitionTracing} from 'shared/ReactFeatureFlags'; +import {enableTransitionTracing} from 'shared/ReactFeatureFlags'; import {isPrimaryRenderer} from './ReactFiberConfig'; import {createCursor, push, pop} from './ReactFiberStack'; import { @@ -98,10 +98,6 @@ const transitionStack: StackCursor | null> = createCursor(null); function peekCacheFromPool(): Cache | null { - if (!enableCache) { - return (null: any); - } - // Check if the cache pool already has a cache we can use. // If we're rendering inside a Suspense boundary that is currently hidden, @@ -173,12 +169,10 @@ export function pushTransition( prevCachePool: SpawnedCachePool | null, newTransitions: Array | null, ): void { - if (enableCache) { - if (prevCachePool === null) { - push(resumedCache, resumedCache.current, offscreenWorkInProgress); - } else { - push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); - } + if (prevCachePool === null) { + push(resumedCache, resumedCache.current, offscreenWorkInProgress); + } else { + push(resumedCache, prevCachePool.pool, offscreenWorkInProgress); } if (enableTransitionTracing) { @@ -202,9 +196,7 @@ export function popTransition(workInProgress: Fiber, current: Fiber | null) { pop(transitionStack, workInProgress); } - if (enableCache) { - pop(resumedCache, workInProgress); - } + pop(resumedCache, workInProgress); } } @@ -217,9 +209,6 @@ export function getPendingTransitions(): Array | null { } export function getSuspendedCache(): SpawnedCachePool | null { - if (!enableCache) { - return null; - } // This function is called when a Suspense boundary suspends. It returns the // cache that would have been used to render fresh data during this render, // if there was any, so that we can resume rendering with the same cache when @@ -240,10 +229,6 @@ export function getSuspendedCache(): SpawnedCachePool | null { } export function getOffscreenDeferredCache(): SpawnedCachePool | null { - if (!enableCache) { - return null; - } - const cacheFromPool = peekCacheFromPool(); if (cacheFromPool === null) { return null; diff --git a/packages/react-reconciler/src/ReactFiberUnwindWork.js b/packages/react-reconciler/src/ReactFiberUnwindWork.js index cc77647cb8556..cdc887b5af819 100644 --- a/packages/react-reconciler/src/ReactFiberUnwindWork.js +++ b/packages/react-reconciler/src/ReactFiberUnwindWork.js @@ -33,7 +33,6 @@ import {DidCapture, NoFlags, ShouldCapture} from './ReactFiberFlags'; import {NoMode, ProfileMode} from './ReactTypeOfMode'; import { enableProfilerTimer, - enableCache, enableTransitionTracing, enableRenderableContext, } from 'shared/ReactFeatureFlags'; @@ -91,10 +90,8 @@ function unwindWork( } case HostRoot: { const root: FiberRoot = workInProgress.stateNode; - if (enableCache) { - const cache: Cache = workInProgress.memoizedState.cache; - popCacheProvider(workInProgress, cache); - } + const cache: Cache = workInProgress.memoizedState.cache; + popCacheProvider(workInProgress, cache); if (enableTransitionTracing) { popRootMarkerInstance(workInProgress); @@ -189,10 +186,8 @@ function unwindWork( return null; } case CacheComponent: - if (enableCache) { - const cache: Cache = workInProgress.memoizedState.cache; - popCacheProvider(workInProgress, cache); - } + const cache: Cache = workInProgress.memoizedState.cache; + popCacheProvider(workInProgress, cache); return null; case TracingMarkerComponent: if (enableTransitionTracing) { @@ -226,10 +221,8 @@ function unwindInterruptedWork( } case HostRoot: { const root: FiberRoot = interruptedWork.stateNode; - if (enableCache) { - const cache: Cache = interruptedWork.memoizedState.cache; - popCacheProvider(interruptedWork, cache); - } + const cache: Cache = interruptedWork.memoizedState.cache; + popCacheProvider(interruptedWork, cache); if (enableTransitionTracing) { popRootMarkerInstance(interruptedWork); @@ -271,10 +264,8 @@ function unwindInterruptedWork( popTransition(interruptedWork, current); break; case CacheComponent: - if (enableCache) { - const cache: Cache = interruptedWork.memoizedState.cache; - popCacheProvider(interruptedWork, cache); - } + const cache: Cache = interruptedWork.memoizedState.cache; + popCacheProvider(interruptedWork, cache); break; case TracingMarkerComponent: if (enableTransitionTracing) { diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index f2fc387d7e27c..9a002ce4b6fd9 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -31,7 +31,6 @@ import { enableProfilerNestedUpdatePhase, enableSchedulingProfiler, enableUpdaterTracking, - enableCache, enableTransitionTracing, useModernStrictMode, disableLegacyContext, @@ -2113,19 +2112,13 @@ function popDispatcher(prevDispatcher: any) { } function pushAsyncDispatcher() { - if (enableCache || __DEV__) { - const prevAsyncDispatcher = ReactSharedInternals.A; - ReactSharedInternals.A = DefaultAsyncDispatcher; - return prevAsyncDispatcher; - } else { - return null; - } + const prevAsyncDispatcher = ReactSharedInternals.A; + ReactSharedInternals.A = DefaultAsyncDispatcher; + return prevAsyncDispatcher; } function popAsyncDispatcher(prevAsyncDispatcher: any) { - if (enableCache || __DEV__) { - ReactSharedInternals.A = prevAsyncDispatcher; - } + ReactSharedInternals.A = prevAsyncDispatcher; } export function markCommitTimeOfFallback() { @@ -3587,16 +3580,14 @@ function makeErrorInfo(componentStack: ?string) { } function releaseRootPooledCache(root: FiberRoot, remainingLanes: Lanes) { - if (enableCache) { - const pooledCacheLanes = (root.pooledCacheLanes &= remainingLanes); - if (pooledCacheLanes === NoLanes) { - // None of the remaining work relies on the cache pool. Clear it so - // subsequent requests get a new cache - const pooledCache = root.pooledCache; - if (pooledCache != null) { - root.pooledCache = null; - releaseCache(pooledCache); - } + const pooledCacheLanes = (root.pooledCacheLanes &= remainingLanes); + if (pooledCacheLanes === NoLanes) { + // None of the remaining work relies on the cache pool. Clear it so + // subsequent requests get a new cache + const pooledCache = root.pooledCache; + if (pooledCache != null) { + root.pooledCache = null; + releaseCache(pooledCache); } } } diff --git a/packages/react-reconciler/src/__tests__/ReactCache-test.js b/packages/react-reconciler/src/__tests__/ReactCache-test.js index 7fd43b0b3611e..e93b68cec3d91 100644 --- a/packages/react-reconciler/src/__tests__/ReactCache-test.js +++ b/packages/react-reconciler/src/__tests__/ReactCache-test.js @@ -30,7 +30,6 @@ describe('ReactCache', () => { __unmockReact(); }); - // @gate enableCache it('cache objects and primitive arguments and a mix of them', async () => { const types = cache((a, b) => ({a: typeof a, b: typeof b})); function Print({a, b}) { @@ -170,7 +169,6 @@ describe('ReactCache', () => { ).toEqual('number number true false false false '); }); - // @gate enableCache it('cached functions that throw should cache the error', async () => { const throws = cache(v => { throw new Error(v); @@ -203,7 +201,6 @@ describe('ReactCache', () => { expect(z).not.toBe(x); }); - // @gate enableCache it('introspection of returned wrapper function is same on client and server', async () => { // When the variant flag is true, test the client version of `cache`. if (gate(flags => flags.variant)) { diff --git a/packages/react-server/src/ReactFizzHooks.js b/packages/react-server/src/ReactFizzHooks.js index a163aa11516b7..83f51c6fb248e 100644 --- a/packages/react-server/src/ReactFizzHooks.js +++ b/packages/react-server/src/ReactFizzHooks.js @@ -39,7 +39,6 @@ import { import {createFastHash} from './ReactServerStreamConfig'; import { - enableCache, enableUseEffectEventHook, enableUseResourceEffectHook, } from 'shared/ReactFeatureFlags'; @@ -859,11 +858,9 @@ export const HooksDispatcher: Dispatcher = supportsClientAPIs useFormState: useActionState, useHostTransitionStatus, useMemoCache, + useCacheRefresh, }; -if (enableCache) { - HooksDispatcher.useCacheRefresh = useCacheRefresh; -} if (enableUseEffectEventHook) { HooksDispatcher.useEffectEvent = useEffectEvent; } diff --git a/packages/react-server/src/ReactFizzServer.js b/packages/react-server/src/ReactFizzServer.js index f18b624a11b9c..e0ff9593bc395 100644 --- a/packages/react-server/src/ReactFizzServer.js +++ b/packages/react-server/src/ReactFizzServer.js @@ -152,7 +152,6 @@ import { disableLegacyContext, disableLegacyContextForFunctionComponents, enableScopeAPI, - enableCache, enablePostpone, enableHalt, enableRenderableContext, @@ -4416,11 +4415,8 @@ export function performWork(request: Request): void { const prevContext = getActiveContext(); const prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = HooksDispatcher; - let prevAsyncDispatcher = null; - if (enableCache || __DEV__) { - prevAsyncDispatcher = ReactSharedInternals.A; - ReactSharedInternals.A = DefaultAsyncDispatcher; - } + const prevAsyncDispatcher = ReactSharedInternals.A; + ReactSharedInternals.A = DefaultAsyncDispatcher; const prevRequest = currentRequest; currentRequest = request; @@ -4450,9 +4446,7 @@ export function performWork(request: Request): void { } finally { setCurrentResumableState(prevResumableState); ReactSharedInternals.H = prevDispatcher; - if (enableCache) { - ReactSharedInternals.A = prevAsyncDispatcher; - } + ReactSharedInternals.A = prevAsyncDispatcher; if (__DEV__) { ReactSharedInternals.getCurrentStack = prevGetCurrentStackImpl; diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 5a1220d7f24c9..d1dc6cb7f7907 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -77,7 +77,6 @@ export const enableLegacyFBSupport = false; // likely to include in an upcoming release. // ----------------------------------------------------------------------------- -export const enableCache = true; export const enableLegacyCache = __EXPERIMENTAL__; export const enableAsyncIterableChildren = __EXPERIMENTAL__; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 0a9d33675daaf..498af214b0188 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -44,7 +44,6 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const disableTextareaChildren = false; export const enableAsyncDebugInfo = false; export const enableAsyncIterableChildren = false; -export const enableCache = true; export const enableCPUSuspense = true; export const enableCreateEventHandleAPI = false; export const enableDeferRootSchedulingToMicrotask = true; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index 52b9a67f77135..fb996a43adb6c 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -31,7 +31,6 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const disableTextareaChildren = false; export const enableAsyncDebugInfo = false; export const enableAsyncIterableChildren = false; -export const enableCache = true; export const enableCPUSuspense = false; export const enableCreateEventHandleAPI = false; export const enableDeferRootSchedulingToMicrotask = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 201d659f657d6..6646a126a0ceb 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -18,7 +18,6 @@ export const enableProfilerCommitHooks = __PROFILE__; export const enableProfilerNestedUpdatePhase = __PROFILE__; export const enableComponentPerformanceTrack = false; export const enableUpdaterTracking = false; -export const enableCache = true; export const enableLegacyCache = __EXPERIMENTAL__; export const enableAsyncIterableChildren = false; export const enableTaint = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js index 1b311a3ecfe66..8f71306c51a62 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js @@ -23,7 +23,6 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const disableTextareaChildren = false; export const enableAsyncDebugInfo = false; export const enableAsyncIterableChildren = false; -export const enableCache = true; export const enableCPUSuspense = true; export const enableCreateEventHandleAPI = false; export const enableDeferRootSchedulingToMicrotask = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index b74d89a4b9cdb..dae38936f8a01 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -18,7 +18,6 @@ export const enableProfilerCommitHooks = __PROFILE__; export const enableProfilerNestedUpdatePhase = __PROFILE__; export const enableComponentPerformanceTrack = false; export const enableUpdaterTracking = false; -export const enableCache = true; export const enableLegacyCache = true; export const enableAsyncIterableChildren = false; export const enableTaint = true; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index e9ec691f0817a..060600286e6de 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -69,7 +69,6 @@ export const enableSchedulingProfiler: boolean = export const disableLegacyContext = __EXPERIMENTAL__; export const enableGetInspectorDataForInstanceInProduction = false; -export const enableCache = true; export const enableLegacyCache = true; export const enableAsyncIterableChildren = false;