@@ -110,6 +110,7 @@ import {
110
110
enableFormActions ,
111
111
enableAsyncActions ,
112
112
enablePostpone ,
113
+ enableRenderableContext ,
113
114
} from 'shared/ReactFeatureFlags' ;
114
115
import isArray from 'shared/isArray' ;
115
116
import shallowEqual from 'shared/shallowEqual' ;
@@ -3528,7 +3529,12 @@ function updateContextProvider(
3528
3529
workInProgress : Fiber ,
3529
3530
renderLanes : Lanes ,
3530
3531
) {
3531
- const context : ReactContext < any > = workInProgress . type ;
3532
+ let context : ReactContext < any > ;
3533
+ if ( enableRenderableContext ) {
3534
+ context = workInProgress . type ;
3535
+ } else {
3536
+ context = workInProgress . type . _context ;
3537
+ }
3532
3538
const newProps = workInProgress . pendingProps ;
3533
3539
const oldProps = workInProgress . memoizedProps ;
3534
3540
@@ -3590,9 +3596,18 @@ function updateContextConsumer(
3590
3596
workInProgress : Fiber ,
3591
3597
renderLanes : Lanes ,
3592
3598
) {
3593
- const consumerType : ReactConsumerType < any > = workInProgress . type ;
3594
- const context = consumerType . _context ;
3595
-
3599
+ let context : ReactContext < any > ;
3600
+ if ( enableRenderableContext ) {
3601
+ const consumerType : ReactConsumerType < any > = workInProgress . type ;
3602
+ context = consumerType . _context ;
3603
+ } else {
3604
+ context = workInProgress . type ;
3605
+ if ( __DEV__ ) {
3606
+ if ( ( context : any ) . _context !== undefined ) {
3607
+ context = ( context : any ) . _context ;
3608
+ }
3609
+ }
3610
+ }
3596
3611
const newProps = workInProgress . pendingProps ;
3597
3612
const render = newProps . children ;
3598
3613
@@ -3838,7 +3853,12 @@ function attemptEarlyBailoutIfNoScheduledUpdate(
3838
3853
break ;
3839
3854
case ContextProvider : {
3840
3855
const newValue = workInProgress . memoizedProps . value ;
3841
- const context : ReactContext < any > = workInProgress . type ;
3856
+ let context : ReactContext < any > ;
3857
+ if ( enableRenderableContext ) {
3858
+ context = workInProgress . type ;
3859
+ } else {
3860
+ context = workInProgress . type . _context ;
3861
+ }
3842
3862
pushProvider ( workInProgress , context , newValue ) ;
3843
3863
break ;
3844
3864
}
0 commit comments