Skip to content

Commit

Permalink
[be] Remove unshipped experimental <Cache> element type (facebook#28698)
Browse files Browse the repository at this point in the history
Removes the `<Cache />` element type since we're going with a simpler
caching strategy.
josephsavona authored and AndyPengc12 committed Apr 15, 2024

Verified

This commit was signed with the committer’s verified signature.
d2iq-dispatch D2iQ Dispatch
1 parent 1099242 commit c74c7e8
Showing 19 changed files with 0 additions and 1,643 deletions.
2 changes: 0 additions & 2 deletions packages/react-devtools-shared/src/__tests__/store-test.js
Original file line number Diff line number Diff line change
@@ -1575,7 +1575,6 @@ describe('Store', () => {
<FakeHigherOrderComponent />
<MemoizedFakeHigherOrderComponent />
<ForwardRefFakeHigherOrderComponent />
<React.unstable_Cache />
<MemoizedFakeHigherOrderComponentWithDisplayNameOverride />
<ForwardRefFakeHigherOrderComponentWithDisplayNameOverride />
</React.Fragment>
@@ -1603,7 +1602,6 @@ describe('Store', () => {
<Baz> [withFoo][withBar]
<Baz> [Memo][withFoo][withBar]
<Baz> [ForwardRef][withFoo][withBar]
<Cache>
<memoRefOverride>
<forwardRefOverride>
`);
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ import {
Profiler,
StrictMode,
Suspense,
unstable_Cache as Cache,
} from 'react';

const Context = createContext('abc');
20 changes: 0 additions & 20 deletions packages/react-reconciler/src/ReactFiber.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ import {
isHostSingletonType,
} from './ReactFiberConfig';
import {
enableCache,
enableProfilerTimer,
enableScopeAPI,
enableLegacyHidden,
@@ -66,7 +65,6 @@ import {
ScopeComponent,
OffscreenComponent,
LegacyHiddenComponent,
CacheComponent,
TracingMarkerComponent,
} from './ReactWorkTags';
import {OffscreenVisible} from './ReactFiberActivityComponent';
@@ -104,7 +102,6 @@ import {
REACT_SCOPE_TYPE,
REACT_OFFSCREEN_TYPE,
REACT_LEGACY_HIDDEN_TYPE,
REACT_CACHE_TYPE,
REACT_TRACING_MARKER_TYPE,
} from 'shared/ReactSymbols';
import {TransitionTracingMarker} from './ReactFiberTracingMarkerComponent';
@@ -560,11 +557,6 @@ export function createFiberFromTypeAndProps(
return createFiberFromScope(type, pendingProps, mode, lanes, key);
}
// Fall through
case REACT_CACHE_TYPE:
if (enableCache) {
return createFiberFromCache(pendingProps, mode, lanes, key);
}
// Fall through
case REACT_TRACING_MARKER_TYPE:
if (enableTransitionTracing) {
return createFiberFromTracingMarker(pendingProps, mode, lanes, key);
@@ -807,18 +799,6 @@ export function createFiberFromLegacyHidden(
return fiber;
}

export function createFiberFromCache(
pendingProps: any,
mode: TypeOfMode,
lanes: Lanes,
key: null | string,
): Fiber {
const fiber = createFiber(CacheComponent, pendingProps, key, mode);
fiber.elementType = REACT_CACHE_TYPE;
fiber.lanes = lanes;
return fiber;
}

export function createFiberFromTracingMarker(
pendingProps: any,
mode: TypeOfMode,
1,597 changes: 0 additions & 1,597 deletions packages/react-reconciler/src/__tests__/ReactCacheElement-test.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/react/index.classic.fb.js
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@ export {
cache,
startTransition,
unstable_Activity,
unstable_Cache,
unstable_TracingMarker,
unstable_DebugTracingMode,
unstable_LegacyHidden,
1 change: 0 additions & 1 deletion packages/react/index.experimental.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ export {
memo,
cache,
startTransition,
unstable_Cache,
unstable_DebugTracingMode,
unstable_Activity,
unstable_postpone,
1 change: 0 additions & 1 deletion packages/react/index.js
Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@ export {
memo,
cache,
startTransition,
unstable_Cache,
unstable_DebugTracingMode,
unstable_LegacyHidden,
unstable_Activity,
1 change: 0 additions & 1 deletion packages/react/index.modern.fb.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ export {
memo,
cache,
startTransition,
unstable_Cache,
unstable_DebugTracingMode,
unstable_LegacyHidden,
unstable_Activity,
2 changes: 0 additions & 2 deletions packages/react/src/ReactClient.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ import {
REACT_LEGACY_HIDDEN_TYPE,
REACT_OFFSCREEN_TYPE,
REACT_SCOPE_TYPE,
REACT_CACHE_TYPE,
REACT_TRACING_MARKER_TYPE,
} from 'shared/ReactSymbols';

@@ -119,7 +118,6 @@ export {
getCacheSignal as unstable_getCacheSignal,
getCacheForType as unstable_getCacheForType,
useCacheRefresh as unstable_useCacheRefresh,
REACT_CACHE_TYPE as unstable_Cache,
use,
useMemoCache as unstable_useMemoCache,
// enableScopeAPI
1 change: 0 additions & 1 deletion packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
@@ -75,7 +75,6 @@ export const enableLegacyFBSupport = false;

export const enableCache = true;
export const enableLegacyCache = __EXPERIMENTAL__;
export const enableCacheElement = __EXPERIMENTAL__;
export const enableFetchInstrumentation = true;

export const enableBinaryFlight = __EXPERIMENTAL__;
1 change: 0 additions & 1 deletion packages/shared/ReactSymbols.js
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@ export const REACT_OFFSCREEN_TYPE: symbol = Symbol.for('react.offscreen');
export const REACT_LEGACY_HIDDEN_TYPE: symbol = Symbol.for(
'react.legacy_hidden',
);
export const REACT_CACHE_TYPE: symbol = Symbol.for('react.cache');
export const REACT_TRACING_MARKER_TYPE: symbol = Symbol.for(
'react.tracing_marker',
);
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
@@ -43,7 +43,6 @@ export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableUpdaterTracking = __PROFILE__;
export const enableCache = true;
export const enableLegacyCache = false;
export const enableCacheElement = true;
export const enableFetchInstrumentation = false;
export const enableBinaryFlight = true;
export const enableTaint = true;
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
@@ -48,7 +48,6 @@ export const enableRenderableContext = __TODO_NEXT_RN_MAJOR__;
const __NEXT_RN_MAJOR__ = true;
export const disableClientCache = __NEXT_RN_MAJOR__;
export const disableLegacyContext = __NEXT_RN_MAJOR__;
export const enableCacheElement = __NEXT_RN_MAJOR__;
export const enableTaint = __NEXT_RN_MAJOR__;
export const enableUnifiedSyncLane = __NEXT_RN_MAJOR__;
export const enableFizzExternalRuntime = __NEXT_RN_MAJOR__; // DOM-only
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableUpdaterTracking = false;
export const enableCache = true;
export const enableLegacyCache = __EXPERIMENTAL__;
export const enableCacheElement = __EXPERIMENTAL__;
export const enableFetchInstrumentation = true;
export const enableBinaryFlight = true;
export const enableTaint = true;
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableUpdaterTracking = false;
export const enableCache = true;
export const enableLegacyCache = false;
export const enableCacheElement = true;
export const enableFetchInstrumentation = false;
export const enableBinaryFlight = true;
export const enableTaint = true;
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableUpdaterTracking = false;
export const enableCache = true;
export const enableLegacyCache = true;
export const enableCacheElement = true;
export const enableFetchInstrumentation = false;
export const enableBinaryFlight = true;
export const enableTaint = true;
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.www.js
Original file line number Diff line number Diff line change
@@ -67,7 +67,6 @@ export const enableGetInspectorDataForInstanceInProduction = false;

export const enableCache = true;
export const enableLegacyCache = true;
export const enableCacheElement = true;
export const enableFetchInstrumentation = false;

export const enableBinaryFlight = false;
6 changes: 0 additions & 6 deletions packages/shared/getComponentNameFromType.js
Original file line number Diff line number Diff line change
@@ -23,13 +23,11 @@ import {
REACT_SUSPENSE_TYPE,
REACT_SUSPENSE_LIST_TYPE,
REACT_LAZY_TYPE,
REACT_CACHE_TYPE,
REACT_TRACING_MARKER_TYPE,
} from 'shared/ReactSymbols';

import {
enableTransitionTracing,
enableCache,
enableRenderableContext,
} from './ReactFeatureFlags';

@@ -83,10 +81,6 @@ export default function getComponentNameFromType(type: mixed): string | null {
return 'Suspense';
case REACT_SUSPENSE_LIST_TYPE:
return 'SuspenseList';
case REACT_CACHE_TYPE:
if (enableCache) {
return 'Cache';
}
// Fall through
case REACT_TRACING_MARKER_TYPE:
if (enableTransitionTracing) {
3 changes: 0 additions & 3 deletions packages/shared/isValidElementType.js
Original file line number Diff line number Diff line change
@@ -23,12 +23,10 @@ import {
REACT_SCOPE_TYPE,
REACT_LEGACY_HIDDEN_TYPE,
REACT_OFFSCREEN_TYPE,
REACT_CACHE_TYPE,
REACT_TRACING_MARKER_TYPE,
} from 'shared/ReactSymbols';
import {
enableScopeAPI,
enableCacheElement,
enableTransitionTracing,
enableDebugTracing,
enableLegacyHidden,
@@ -53,7 +51,6 @@ export default function isValidElementType(type: mixed): boolean {
(enableLegacyHidden && type === REACT_LEGACY_HIDDEN_TYPE) ||
type === REACT_OFFSCREEN_TYPE ||
(enableScopeAPI && type === REACT_SCOPE_TYPE) ||
(enableCacheElement && type === REACT_CACHE_TYPE) ||
(enableTransitionTracing && type === REACT_TRACING_MARKER_TYPE)
) {
return true;

0 comments on commit c74c7e8

Please sign in to comment.