From b3f3da205b9abfc3c70e7018b03114a33ef43ca5 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Wed, 23 Feb 2022 18:52:08 -0500 Subject: [PATCH] Land warnOnSubscriptionInsideStartTransition flag (#23353) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We're including this in 18. The feature was already enabled — this just removes the flag. --- packages/react-reconciler/src/ReactFiberHooks.new.js | 7 +------ packages/react-reconciler/src/ReactFiberHooks.old.js | 7 +------ packages/react-reconciler/src/ReactFiberWorkLoop.new.js | 7 +------ packages/react-reconciler/src/ReactFiberWorkLoop.old.js | 7 +------ packages/react/src/ReactStartTransition.js | 7 +------ packages/react/src/__tests__/ReactStartTransition-test.js | 1 - 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 - .../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-dynamic.js | 1 - packages/shared/forks/ReactFeatureFlags.www.js | 1 - 16 files changed, 5 insertions(+), 41 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberHooks.new.js b/packages/react-reconciler/src/ReactFiberHooks.new.js index 9e4f954b1e88e..31e716935bc34 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.new.js +++ b/packages/react-reconciler/src/ReactFiberHooks.new.js @@ -109,7 +109,6 @@ import { entangleTransitions as entangleLegacyQueueTransitions, } from './ReactUpdateQueue.new'; import {pushInterleavedQueue} from './ReactFiberInterleavedUpdates.new'; -import {warnOnSubscriptionInsideStartTransition} from 'shared/ReactFeatureFlags'; import {getTreeId} from './ReactFiberTreeContext.new'; const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals; @@ -1992,11 +1991,7 @@ function startTransition(setPending, callback) { ReactCurrentBatchConfig.transition = prevTransition; if (__DEV__) { - if ( - prevTransition === null && - warnOnSubscriptionInsideStartTransition && - currentTransition._updatedFibers - ) { + if (prevTransition === null && currentTransition._updatedFibers) { const updatedFibersCount = currentTransition._updatedFibers.size; if (updatedFibersCount > 10) { console.warn( diff --git a/packages/react-reconciler/src/ReactFiberHooks.old.js b/packages/react-reconciler/src/ReactFiberHooks.old.js index becadf35bd88f..bd9e2488a8841 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.old.js +++ b/packages/react-reconciler/src/ReactFiberHooks.old.js @@ -109,7 +109,6 @@ import { entangleTransitions as entangleLegacyQueueTransitions, } from './ReactUpdateQueue.old'; import {pushInterleavedQueue} from './ReactFiberInterleavedUpdates.old'; -import {warnOnSubscriptionInsideStartTransition} from 'shared/ReactFeatureFlags'; import {getTreeId} from './ReactFiberTreeContext.old'; const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals; @@ -1992,11 +1991,7 @@ function startTransition(setPending, callback) { ReactCurrentBatchConfig.transition = prevTransition; if (__DEV__) { - if ( - prevTransition === null && - warnOnSubscriptionInsideStartTransition && - currentTransition._updatedFibers - ) { + if (prevTransition === null && currentTransition._updatedFibers) { const updatedFibersCount = currentTransition._updatedFibers.size; if (updatedFibersCount > 10) { console.warn( diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index cf0fb63f1936a..71bce2613251e 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -31,7 +31,6 @@ import { disableSchedulerTimeoutInWorkLoop, enableStrictEffects, enableUpdaterTracking, - warnOnSubscriptionInsideStartTransition, enableCache, } from 'shared/ReactFeatureFlags'; import ReactSharedInternals from 'shared/ReactSharedInternals'; @@ -397,11 +396,7 @@ export function requestUpdateLane(fiber: Fiber): Lane { const isTransition = requestCurrentTransition() !== NoTransition; if (isTransition) { - if ( - __DEV__ && - warnOnSubscriptionInsideStartTransition && - ReactCurrentBatchConfig.transition !== null - ) { + if (__DEV__ && ReactCurrentBatchConfig.transition !== null) { const transition = ReactCurrentBatchConfig.transition; if (!transition._updatedFibers) { transition._updatedFibers = new Set(); diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index b823ed9133130..7a02471993612 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -31,7 +31,6 @@ import { disableSchedulerTimeoutInWorkLoop, enableStrictEffects, enableUpdaterTracking, - warnOnSubscriptionInsideStartTransition, enableCache, } from 'shared/ReactFeatureFlags'; import ReactSharedInternals from 'shared/ReactSharedInternals'; @@ -397,11 +396,7 @@ export function requestUpdateLane(fiber: Fiber): Lane { const isTransition = requestCurrentTransition() !== NoTransition; if (isTransition) { - if ( - __DEV__ && - warnOnSubscriptionInsideStartTransition && - ReactCurrentBatchConfig.transition !== null - ) { + if (__DEV__ && ReactCurrentBatchConfig.transition !== null) { const transition = ReactCurrentBatchConfig.transition; if (!transition._updatedFibers) { transition._updatedFibers = new Set(); diff --git a/packages/react/src/ReactStartTransition.js b/packages/react/src/ReactStartTransition.js index 48f9ff96ffa7d..a7097f5b1c52b 100644 --- a/packages/react/src/ReactStartTransition.js +++ b/packages/react/src/ReactStartTransition.js @@ -8,7 +8,6 @@ */ import ReactCurrentBatchConfig from './ReactCurrentBatchConfig'; -import {warnOnSubscriptionInsideStartTransition} from 'shared/ReactFeatureFlags'; export function startTransition(scope: () => void) { const prevTransition = ReactCurrentBatchConfig.transition; @@ -24,11 +23,7 @@ export function startTransition(scope: () => void) { ReactCurrentBatchConfig.transition = prevTransition; if (__DEV__) { - if ( - prevTransition === null && - warnOnSubscriptionInsideStartTransition && - currentTransition._updatedFibers - ) { + if (prevTransition === null && currentTransition._updatedFibers) { const updatedFibersCount = currentTransition._updatedFibers.size; if (updatedFibersCount > 10) { console.warn( diff --git a/packages/react/src/__tests__/ReactStartTransition-test.js b/packages/react/src/__tests__/ReactStartTransition-test.js index 94e45fb189e95..2408e7ace1d49 100644 --- a/packages/react/src/__tests__/ReactStartTransition-test.js +++ b/packages/react/src/__tests__/ReactStartTransition-test.js @@ -27,7 +27,6 @@ describe('ReactStartTransition', () => { useTransition = React.useTransition; }); - // @gate warnOnSubscriptionInsideStartTransition || !__DEV__ it('Warns if a suspicious number of fibers are updated inside startTransition', () => { const subs = new Set(); const useUserSpaceSubscription = () => { diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 28512056bf4f7..540a9d03ccbc7 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -13,7 +13,6 @@ // Flags that can likely be deleted or landed without consequences // ----------------------------------------------------------------------------- -export const warnOnSubscriptionInsideStartTransition = false; export const enableSuspenseServerRenderer = true; export const enableSelectiveHydration = true; export const warnAboutDeprecatedLifecycles = true; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 810c5723e5a48..2e7ed5b2528a3 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -49,7 +49,6 @@ export const disableTextareaChildren = false; export const disableModulePatternComponents = false; export const warnUnstableRenderSubtreeIntoContainer = false; export const warnAboutSpreadingKeyToJSX = false; -export const warnOnSubscriptionInsideStartTransition = false; export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index be80da90ebf35..1a64e8c7aa07f 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -40,7 +40,6 @@ export const disableTextareaChildren = false; export const disableModulePatternComponents = false; export const warnUnstableRenderSubtreeIntoContainer = false; export const warnAboutSpreadingKeyToJSX = false; -export const warnOnSubscriptionInsideStartTransition = false; export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index a34948b63b8e2..e4f3393fe8385 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -40,7 +40,6 @@ export const disableTextareaChildren = false; export const disableModulePatternComponents = false; export const warnUnstableRenderSubtreeIntoContainer = false; export const warnAboutSpreadingKeyToJSX = false; -export const warnOnSubscriptionInsideStartTransition = false; export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js index e86dbbecdf855..7169629762f1f 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js @@ -49,7 +49,6 @@ export const enableSuspenseLayoutEffectSemantics = false; export const enableGetInspectorDataForInstanceInProduction = false; export const enableNewReconciler = false; export const deferRenderPhaseUpdateToNextBatch = false; -export const warnOnSubscriptionInsideStartTransition = false; export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index f0c4e70afacc5..ec04b6be37a06 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -40,7 +40,6 @@ export const disableTextareaChildren = false; export const disableModulePatternComponents = true; export const warnUnstableRenderSubtreeIntoContainer = false; export const warnAboutSpreadingKeyToJSX = false; -export const warnOnSubscriptionInsideStartTransition = false; export const enableSuspenseAvoidThisFallback = true; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.js b/packages/shared/forks/ReactFeatureFlags.testing.js index f4a35bdb8979e..dfe9625873e86 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.js @@ -40,7 +40,6 @@ export const disableTextareaChildren = false; export const disableModulePatternComponents = false; export const warnUnstableRenderSubtreeIntoContainer = false; export const warnAboutSpreadingKeyToJSX = false; -export const warnOnSubscriptionInsideStartTransition = false; export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.www.js b/packages/shared/forks/ReactFeatureFlags.testing.www.js index e4f80908883e0..a9ef92b69a446 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.www.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.www.js @@ -40,7 +40,6 @@ export const disableTextareaChildren = __EXPERIMENTAL__; export const disableModulePatternComponents = true; export const warnUnstableRenderSubtreeIntoContainer = false; export const warnAboutSpreadingKeyToJSX = false; -export const warnOnSubscriptionInsideStartTransition = false; export const enableSuspenseAvoidThisFallback = true; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; diff --git a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js index 61898e5a6eeca..055cbd5d1e973 100644 --- a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js @@ -24,7 +24,6 @@ export const disableSchedulerTimeoutInWorkLoop = __VARIANT__; export const enableLazyContextPropagation = __VARIANT__; export const enableSyncDefaultUpdates = __VARIANT__; export const consoleManagedByDevToolsDuringStrictMode = __VARIANT__; -export const warnOnSubscriptionInsideStartTransition = __VARIANT__; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = __VARIANT__; export const enableClientRenderFallbackOnHydrationMismatch = __VARIANT__; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index b0e55bdab05fb..381fa5532edad 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -30,7 +30,6 @@ export const { disableSchedulerTimeoutInWorkLoop, enableLazyContextPropagation, enableSyncDefaultUpdates, - warnOnSubscriptionInsideStartTransition, enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, enableClientRenderFallbackOnHydrationMismatch, } = dynamicFeatureFlags;