@@ -39,12 +39,11 @@ import {
3939 enableLazyContextPropagation ,
4040 enableTransitionTracing ,
4141 enableUseEffectEventHook ,
42+ enableUseResourceEffectHook ,
4243 enableLegacyCache ,
4344 debugRenderPhaseSideEffectsForStrictMode ,
4445 disableLegacyMode ,
4546 enableNoCloningMemoCache ,
46- enableContextProfiling ,
47- enableUseResourceEffectHook ,
4847} from 'shared/ReactFeatureFlags' ;
4948import {
5049 REACT_CONTEXT_TYPE ,
@@ -78,11 +77,7 @@ import {
7877 ContinuousEventPriority ,
7978 higherEventPriority ,
8079} from './ReactEventPriorities' ;
81- import {
82- readContext ,
83- readContextAndCompare ,
84- checkIfContextChanged ,
85- } from './ReactFiberNewContext' ;
80+ import { readContext , checkIfContextChanged } from './ReactFiberNewContext' ;
8681import { HostRoot , CacheComponent , HostComponent } from './ReactWorkTags' ;
8782import {
8883 LayoutStatic as LayoutStaticEffect ,
@@ -1111,16 +1106,6 @@ function updateWorkInProgressHook(): Hook {
11111106 return workInProgressHook ;
11121107}
11131108
1114- function unstable_useContextWithBailout < T > (
1115- context : ReactContext < T > ,
1116- select : ( T => Array < mixed > ) | null ,
1117- ) : T {
1118- if ( select === null ) {
1119- return readContext ( context ) ;
1120- }
1121- return readContextAndCompare ( context , select ) ;
1122- }
1123-
11241109function createFunctionComponentUpdateQueue ( ) : FunctionComponentUpdateQueue {
11251110 return {
11261111 lastEffect : null ,
@@ -3958,10 +3943,6 @@ if (enableUseEffectEventHook) {
39583943if (enableUseResourceEffectHook) {
39593944 ( ContextOnlyDispatcher : Dispatcher ) . useResourceEffect = throwInvalidHookError ;
39603945}
3961- if (enableContextProfiling) {
3962- ( ContextOnlyDispatcher : Dispatcher ) . unstable_useContextWithBailout =
3963- throwInvalidHookError ;
3964- }
39653946
39663947const HooksDispatcherOnMount: Dispatcher = {
39673948 readContext ,
@@ -3995,10 +3976,6 @@ if (enableUseEffectEventHook) {
39953976if (enableUseResourceEffectHook) {
39963977 ( HooksDispatcherOnMount : Dispatcher ) . useResourceEffect = mountResourceEffect ;
39973978}
3998- if (enableContextProfiling) {
3999- ( HooksDispatcherOnMount : Dispatcher ) . unstable_useContextWithBailout =
4000- unstable_useContextWithBailout ;
4001- }
40023979
40033980const HooksDispatcherOnUpdate: Dispatcher = {
40043981 readContext ,
@@ -4033,10 +4010,6 @@ if (enableUseResourceEffectHook) {
40334010 ( HooksDispatcherOnUpdate : Dispatcher ) . useResourceEffect =
40344011 updateResourceEffect ;
40354012}
4036- if (enableContextProfiling) {
4037- ( HooksDispatcherOnUpdate : Dispatcher ) . unstable_useContextWithBailout =
4038- unstable_useContextWithBailout ;
4039- }
40404013
40414014const HooksDispatcherOnRerender: Dispatcher = {
40424015 readContext ,
@@ -4071,10 +4044,6 @@ if (enableUseResourceEffectHook) {
40714044 ( HooksDispatcherOnRerender : Dispatcher ) . useResourceEffect =
40724045 updateResourceEffect ;
40734046}
4074- if (enableContextProfiling) {
4075- ( HooksDispatcherOnRerender : Dispatcher ) . unstable_useContextWithBailout =
4076- unstable_useContextWithBailout ;
4077- }
40784047
40794048let HooksDispatcherOnMountInDEV: Dispatcher | null = null;
40804049let HooksDispatcherOnMountWithHookTypesInDEV: Dispatcher | null = null;
@@ -4296,17 +4265,6 @@ if (__DEV__) {
42964265 ) ;
42974266 } ;
42984267 }
4299- if ( enableContextProfiling ) {
4300- ( HooksDispatcherOnMountInDEV : Dispatcher ) . unstable_useContextWithBailout =
4301- function < T > (
4302- context: ReactContext< T > ,
4303- select: (T => Array < mixed > ) | null ,
4304- ) : T {
4305- currentHookNameInDev = 'useContext' ;
4306- mountHookTypesDev ( ) ;
4307- return unstable_useContextWithBailout ( context , select ) ;
4308- } ;
4309- }
43104268
43114269 HooksDispatcherOnMountWithHookTypesInDEV = {
43124270 readContext < T > (context: ReactContext< T > ): T {
@@ -4494,17 +4452,6 @@ if (__DEV__) {
44944452 ) ;
44954453 } ;
44964454 }
4497- if ( enableContextProfiling ) {
4498- ( HooksDispatcherOnMountWithHookTypesInDEV : Dispatcher ) . unstable_useContextWithBailout =
4499- function < T > (
4500- context: ReactContext< T > ,
4501- select: (T => Array < mixed > ) | null ,
4502- ) : T {
4503- currentHookNameInDev = 'useContext' ;
4504- updateHookTypesDev ( ) ;
4505- return unstable_useContextWithBailout ( context , select ) ;
4506- } ;
4507- }
45084455
45094456 HooksDispatcherOnUpdateInDEV = {
45104457 readContext < T > (context: ReactContext< T > ): T {
@@ -4692,17 +4639,6 @@ if (__DEV__) {
46924639 ) ;
46934640 } ;
46944641 }
4695- if ( enableContextProfiling ) {
4696- ( HooksDispatcherOnUpdateInDEV : Dispatcher ) . unstable_useContextWithBailout =
4697- function < T > (
4698- context: ReactContext< T > ,
4699- select: (T => Array < mixed > ) | null ,
4700- ) : T {
4701- currentHookNameInDev = 'useContext' ;
4702- updateHookTypesDev ( ) ;
4703- return unstable_useContextWithBailout ( context , select ) ;
4704- } ;
4705- }
47064642
47074643 HooksDispatcherOnRerenderInDEV = {
47084644 readContext < T > (context: ReactContext< T > ): T {
@@ -4890,17 +4826,6 @@ if (__DEV__) {
48904826 ) ;
48914827 } ;
48924828 }
4893- if ( enableContextProfiling ) {
4894- ( HooksDispatcherOnUpdateInDEV : Dispatcher ) . unstable_useContextWithBailout =
4895- function < T > (
4896- context: ReactContext< T > ,
4897- select: (T => Array < mixed > ) | null ,
4898- ) : T {
4899- currentHookNameInDev = 'useContext' ;
4900- updateHookTypesDev ( ) ;
4901- return unstable_useContextWithBailout ( context , select ) ;
4902- } ;
4903- }
49044829
49054830 InvalidNestedHooksDispatcherOnMountInDEV = {
49064831 readContext < T > (context: ReactContext< T > ): T {
@@ -5114,18 +5039,6 @@ if (__DEV__) {
51145039 ) ;
51155040 } ;
51165041 }
5117- if ( enableContextProfiling ) {
5118- ( HooksDispatcherOnUpdateInDEV : Dispatcher ) . unstable_useContextWithBailout =
5119- function < T > (
5120- context: ReactContext< T > ,
5121- select: (T => Array < mixed > ) | null ,
5122- ) : T {
5123- currentHookNameInDev = 'useContext' ;
5124- warnInvalidHookAccess ( ) ;
5125- mountHookTypesDev ( ) ;
5126- return unstable_useContextWithBailout ( context , select ) ;
5127- } ;
5128- }
51295042
51305043 InvalidNestedHooksDispatcherOnUpdateInDEV = {
51315044 readContext < T > (context: ReactContext< T > ): T {
@@ -5339,18 +5252,6 @@ if (__DEV__) {
53395252 ) ;
53405253 } ;
53415254 }
5342- if ( enableContextProfiling ) {
5343- ( InvalidNestedHooksDispatcherOnUpdateInDEV : Dispatcher ) . unstable_useContextWithBailout =
5344- function < T > (
5345- context: ReactContext< T > ,
5346- select: (T => Array < mixed > ) | null ,
5347- ) : T {
5348- currentHookNameInDev = 'useContext' ;
5349- warnInvalidHookAccess ( ) ;
5350- updateHookTypesDev ( ) ;
5351- return unstable_useContextWithBailout ( context , select ) ;
5352- } ;
5353- }
53545255
53555256 InvalidNestedHooksDispatcherOnRerenderInDEV = {
53565257 readContext < T > (context: ReactContext< T > ): T {
@@ -5564,16 +5465,4 @@ if (__DEV__) {
55645465 ) ;
55655466 } ;
55665467 }
5567- if ( enableContextProfiling ) {
5568- ( InvalidNestedHooksDispatcherOnRerenderInDEV : Dispatcher ) . unstable_useContextWithBailout =
5569- function < T > (
5570- context: ReactContext< T > ,
5571- select: (T => Array < mixed > ) | null ,
5572- ) : T {
5573- currentHookNameInDev = 'useContext' ;
5574- warnInvalidHookAccess ( ) ;
5575- updateHookTypesDev ( ) ;
5576- return unstable_useContextWithBailout ( context , select ) ;
5577- } ;
5578- }
55795468}
0 commit comments