From d1f04722d617600cc6cd96dcebc1c2ef7affc904 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Wed, 6 Nov 2024 09:00:49 -0500 Subject: [PATCH] [string-refs] remove enableLogStringRefsProd flag (#31414) We no longer need this production logging. --- packages/react/src/jsx/ReactJSXElement.js | 8 ++------ packages/shared/ReactFeatureFlags.js | 8 -------- 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.www.js | 1 - packages/shared/forks/ReactFeatureFlags.www-dynamic.js | 1 - packages/shared/forks/ReactFeatureFlags.www.js | 1 - 8 files changed, 2 insertions(+), 20 deletions(-) diff --git a/packages/react/src/jsx/ReactJSXElement.js b/packages/react/src/jsx/ReactJSXElement.js index 1d1848e3418b8..3722638ad9515 100644 --- a/packages/react/src/jsx/ReactJSXElement.js +++ b/packages/react/src/jsx/ReactJSXElement.js @@ -23,7 +23,6 @@ import { disableStringRefs, disableDefaultPropsExceptForClasses, enableOwnerStacks, - enableLogStringRefsProd, } from 'shared/ReactFeatureFlags'; import {checkPropStringCoercion} from 'shared/CheckStringCoercion'; import {ClassComponent} from 'react-reconciler/src/ReactWorkTags'; @@ -75,7 +74,7 @@ let didWarnAboutStringRefs; let didWarnAboutElementRef; let didWarnAboutOldJSXRuntime; -if (__DEV__ || enableLogStringRefsProd) { +if (__DEV__) { didWarnAboutStringRefs = {}; didWarnAboutElementRef = {}; } @@ -1228,16 +1227,13 @@ function stringRefAsCallbackRef(stringRef, type, owner, value) { ); } - if (__DEV__ || enableLogStringRefsProd) { + if (__DEV__) { if ( // Will already warn with "Function components cannot be given refs" !(typeof type === 'function' && !isReactClass(type)) ) { const componentName = getComponentNameFromFiber(owner) || 'Component'; if (!didWarnAboutStringRefs[componentName]) { - if (enableLogStringRefsProd) { - enableLogStringRefsProd(componentName, stringRef); - } if (__DEV__) { console.error( 'Component "%s" contains the string ref "%s". Support for string refs ' + diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index a0722c31382da..d1159e60373cd 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -210,14 +210,6 @@ export const disableClientCache = true; export const disableStringRefs = true; -/** - * If set to a function, the function will be called with the component name - * and ref string. - * - * NOTE: This happens also in the production build. - */ -export const enableLogStringRefsProd: null | ((string, string) => void) = null; - // Warn on any usage of ReactTestRenderer export const enableReactTestRendererWarning = true; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index b4339c50a5f2f..7e63db5ef45ed 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -65,7 +65,6 @@ export const enableLazyContextPropagation = true; export const enableLegacyCache = false; export const enableLegacyFBSupport = false; export const enableLegacyHidden = false; -export const enableLogStringRefsProd: null | ((string, string) => void) = null; export const enableNoCloningMemoCache = false; export const enableOwnerStacks = false; export const enablePostpone = false; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index ea670690a5a93..644b23b46afae 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -56,7 +56,6 @@ export const enableContextProfiling = false; export const enableLegacyCache = false; export const enableLegacyFBSupport = false; export const enableLegacyHidden = false; -export const enableLogStringRefsProd: null | ((string, string) => void) = null; export const enableNoCloningMemoCache = false; export const enableObjectFiber = false; export const enableOwnerStacks = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 2eb241af6c293..2946d5efa11bc 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -44,7 +44,6 @@ export const enableUseEffectEventHook = false; export const favorSafetyOverHydrationPerf = true; export const enableComponentStackLocations = true; export const enableLegacyFBSupport = false; -export const enableLogStringRefsProd: null | ((string, string) => void) = null; export const enableFilterEmptyStringAttributesDOM = true; export const enableGetInspectorDataForInstanceInProduction = false; export const enableFabricCompleteRootInCommitPhase = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 5c836b48fe2e9..5700a17f04636 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -46,7 +46,6 @@ export const enableUseEffectEventHook = false; export const favorSafetyOverHydrationPerf = true; export const enableComponentStackLocations = true; export const enableLegacyFBSupport = false; -export const enableLogStringRefsProd: null | ((string, string) => void) = null; export const enableFilterEmptyStringAttributesDOM = true; export const enableGetInspectorDataForInstanceInProduction = false; export const enableRenderableContext = false; diff --git a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js index d4102efb06bcd..1c740f5211f89 100644 --- a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js @@ -22,7 +22,6 @@ export const disableStringRefs = __VARIANT__; export const enableDeferRootSchedulingToMicrotask = __VARIANT__; export const enableDO_NOT_USE_disableStrictPassiveEffect = __VARIANT__; export const enableHiddenSubtreeInsertionEffectCleanup = __VARIANT__; -export const enableLogStringRefsProd: null | ((string, string) => void) = null; export const enableNoCloningMemoCache = __VARIANT__; export const enableObjectFiber = __VARIANT__; export const enableRenderableContext = __VARIANT__; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index b86394ecf739b..c28a77626aec0 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -25,7 +25,6 @@ export const { enableDO_NOT_USE_disableStrictPassiveEffect, enableHiddenSubtreeInsertionEffectCleanup, enableInfiniteRenderLoopDetection, - enableLogStringRefsProd, enableNoCloningMemoCache, enableObjectFiber, enableRenderableContext,