From 577f2de46cb2f6d71380551478a02de3965a764b Mon Sep 17 00:00:00 2001 From: David McCabe Date: Sun, 20 Mar 2022 20:41:02 -0700 Subject: [PATCH] enableCacheElement flag (#24131) * enableCacheElement flag * Update packages/shared/forks/ReactFeatureFlags.testing.js Co-authored-by: Ricky * Update packages/shared/forks/ReactFeatureFlags.test-renderer.js Co-authored-by: Ricky * Update packages/shared/forks/ReactFeatureFlags.native-oss.js Co-authored-by: Ricky * Update packages/shared/ReactFeatureFlags.js Co-authored-by: Ricky Co-authored-by: Dave McCabe Co-authored-by: Ricky --- packages/shared/ReactFeatureFlags.js | 1 + packages/shared/forks/ReactFeatureFlags.native-fb.js | 1 + packages/shared/forks/ReactFeatureFlags.native-oss.js | 1 + packages/shared/forks/ReactFeatureFlags.test-renderer.js | 1 + .../shared/forks/ReactFeatureFlags.test-renderer.native.js | 1 + packages/shared/forks/ReactFeatureFlags.test-renderer.www.js | 1 + packages/shared/forks/ReactFeatureFlags.testing.js | 1 + packages/shared/forks/ReactFeatureFlags.testing.www.js | 1 + packages/shared/forks/ReactFeatureFlags.www.js | 1 + packages/shared/isValidElementType.js | 4 ++-- 10 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index a6bba286a6d20..33261df6d76d7 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -96,6 +96,7 @@ export const enableLegacyFBSupport = false; // ----------------------------------------------------------------------------- export const enableCache = __EXPERIMENTAL__; +export const enableCacheElement = __EXPERIMENTAL__; export const enableTransitionTracing = false; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index d834914a24f8f..facc9c7d78369 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -30,6 +30,7 @@ export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; export const enableLazyElements = false; export const enableCache = false; +export const enableCacheElement = true; export const enableSchedulerDebugging = false; export const debugRenderPhaseSideEffectsForStrictMode = true; export const disableJavaScriptURLs = false; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index 94c76a4c82f3a..94bd838658962 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -24,6 +24,7 @@ export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; export const enableLazyElements = false; export const enableCache = false; +export const enableCacheElement = false; export const disableJavaScriptURLs = false; export const disableCommentsAsDOMContainers = true; export const disableInputAttributeSyncing = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index e28fd76fcd87b..b0c81a7a8bb34 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -24,6 +24,7 @@ export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; export const enableLazyElements = false; export const enableCache = __EXPERIMENTAL__; +export const enableCacheElement = __EXPERIMENTAL__; export const disableJavaScriptURLs = false; export const disableCommentsAsDOMContainers = true; export const disableInputAttributeSyncing = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js index 4214fc7b79bc8..e05dc109843c7 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js @@ -24,6 +24,7 @@ export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; export const enableLazyElements = false; export const enableCache = true; +export const enableCacheElement = true; export const disableJavaScriptURLs = false; export const disableCommentsAsDOMContainers = true; export const disableInputAttributeSyncing = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index d025cafa3bc42..042c2519043b1 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -24,6 +24,7 @@ export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; export const enableLazyElements = false; export const enableCache = true; +export const enableCacheElement = true; export const enableSchedulerDebugging = false; export const disableJavaScriptURLs = false; export const disableCommentsAsDOMContainers = true; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.js b/packages/shared/forks/ReactFeatureFlags.testing.js index 40b1fa2d5d79c..6b640311000fb 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.js @@ -24,6 +24,7 @@ export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; export const enableLazyElements = false; export const enableCache = __EXPERIMENTAL__; +export const enableCacheElement = __EXPERIMENTAL__; export const disableJavaScriptURLs = false; export const disableCommentsAsDOMContainers = true; export const disableInputAttributeSyncing = false; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.www.js b/packages/shared/forks/ReactFeatureFlags.testing.www.js index e5e8e7295c844..5e41ca9992da4 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.www.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.www.js @@ -24,6 +24,7 @@ export const enableSuspenseServerRenderer = true; export const enableSelectiveHydration = true; export const enableLazyElements = false; export const enableCache = true; +export const enableCacheElement = true; export const disableJavaScriptURLs = true; export const disableCommentsAsDOMContainers = true; export const disableInputAttributeSyncing = false; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index be3d5aa040a2d..d5edae5563a5b 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -72,6 +72,7 @@ export const enableSelectiveHydration = true; export const enableLazyElements = true; export const enableCache = true; +export const enableCacheElement = true; export const disableJavaScriptURLs = true; diff --git a/packages/shared/isValidElementType.js b/packages/shared/isValidElementType.js index 12d00f3e06f95..87424982afc11 100644 --- a/packages/shared/isValidElementType.js +++ b/packages/shared/isValidElementType.js @@ -27,7 +27,7 @@ import { } from 'shared/ReactSymbols'; import { enableScopeAPI, - enableCache, + enableCacheElement, enableTransitionTracing, enableDebugTracing, enableLegacyHidden, @@ -51,7 +51,7 @@ export default function isValidElementType(type: mixed) { (enableLegacyHidden && type === REACT_LEGACY_HIDDEN_TYPE) || type === REACT_OFFSCREEN_TYPE || (enableScopeAPI && type === REACT_SCOPE_TYPE) || - (enableCache && type === REACT_CACHE_TYPE) || + (enableCacheElement && type === REACT_CACHE_TYPE) || (enableTransitionTracing && type === REACT_TRACING_MARKER_TYPE) ) { return true;