@samitouri / QOS-React-1 / commits / 6c86e56a0f

Remove feature flag enableRenderableContext (#33505)

The flag is fully rolled out.

Jan Kassens committed Jun 11, 2025 at 11:53 UTC 6c86e56a0fa3c8f253da133330cd5b7d1d20e7e5
27 files changed +48 -292
packages/react-client/src/ReactFlightReplyClient.js
+1 -7
@@ -18,13 +18,10 @@ import type {
18 import type {LazyComponent} from 'react/src/ReactLazy';
19 import type {TemporaryReferenceSet} from './ReactFlightTemporaryReferences';
20
21 -import {enableRenderableContext} from 'shared/ReactFeatureFlags';
22 -
21 import {
22 REACT_ELEMENT_TYPE,
23 REACT_LAZY_TYPE,
24 REACT_CONTEXT_TYPE,
27 - REACT_PROVIDER_TYPE,
25 getIteratorFn,
26 ASYNC_ITERATOR,
27 } from 'shared/ReactSymbols';
@@ -699,10 +696,7 @@ export function processReply(
696 return serializeTemporaryReferenceMarker();
697 }
698 if (__DEV__) {
702 - if (
703 - (value: any).$$typeof ===
704 - (enableRenderableContext ? REACT_CONTEXT_TYPE : REACT_PROVIDER_TYPE)
705 - ) {
699 + if ((value: any).$$typeof === REACT_CONTEXT_TYPE) {
700 console.error(
701 'React Context Providers cannot be passed to Server Functions from the Client.%s',
702 describeObjectForErrorMessage(parent, key),
packages/react-devtools-shared/src/utils.js
+5 -11
@@ -19,14 +19,12 @@ import {
19 REACT_MEMO_TYPE,
20 REACT_PORTAL_TYPE,
21 REACT_PROFILER_TYPE,
22 - REACT_PROVIDER_TYPE,
22 REACT_STRICT_MODE_TYPE,
23 REACT_SUSPENSE_LIST_TYPE,
24 REACT_SUSPENSE_TYPE,
25 REACT_TRACING_MARKER_TYPE,
26 REACT_VIEW_TRANSITION_TYPE,
27 } from 'shared/ReactSymbols';
29 -import {enableRenderableContext} from 'shared/ReactFeatureFlags';
28 import {
29 TREE_OPERATION_ADD,
30 TREE_OPERATION_REMOVE,
@@ -87,6 +85,9 @@ const encodedStringCache: LRUCache<string, Array<number>> = new LRU({
85 max: 1000,
86 });
87
88 +// Previously, the type of `Context.Provider`.
89 +const LEGACY_REACT_PROVIDER_TYPE: symbol = Symbol.for('react.provider');
90 +
91 export function alphaSortKeys(
92 a: string | number | symbol,
93 b: string | number | symbol,
@@ -712,14 +713,7 @@ function typeOfWithLegacyElementSymbol(object: any): mixed {
713 case REACT_MEMO_TYPE:
714 return $$typeofType;
715 case REACT_CONSUMER_TYPE:
715 - if (enableRenderableContext) {
716 - return $$typeofType;
717 - }
718 - // Fall through
719 - case REACT_PROVIDER_TYPE:
720 - if (!enableRenderableContext) {
721 - return $$typeofType;
722 - }
716 + return $$typeofType;
717 // Fall through
718 default:
719 return $$typeof;
@@ -740,7 +734,7 @@ export function getDisplayNameForReactElement(
734 switch (elementType) {
735 case REACT_CONSUMER_TYPE:
736 return 'ContextConsumer';
743 - case REACT_PROVIDER_TYPE:
737 + case LEGACY_REACT_PROVIDER_TYPE:
738 return 'ContextProvider';
739 case REACT_CONTEXT_TYPE:
740 return 'Context';
packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js
-6
@@ -295,12 +295,6 @@ describe('ReactDOMServerIntegration', () => {
295 });
296
297 itRenders('should treat Context as Context.Provider', async render => {
298 - // The `itRenders` helpers don't work with the gate pragma, so we have to do
299 - // this instead.
300 - if (gate(flags => !flags.enableRenderableContext)) {
301 - return;
302 - }
303 -
298 const Theme = React.createContext('dark');
299 const Language = React.createContext('french');
300
packages/react-dom/src/__tests__/ReactServerRendering-test.js
-1
@@ -932,7 +932,6 @@ describe('ReactDOMServer', () => {
932 ]);
933 });
934
935 - // @gate enableRenderableContext || !__DEV__
935 it('should warn if an invalid contextType is defined', () => {
936 const Context = React.createContext();
937 class ComponentA extends React.Component {
packages/react-is/src/ReactIs.js
+6 -28
@@ -18,7 +18,6 @@ import {
18 REACT_MEMO_TYPE,
19 REACT_PORTAL_TYPE,
20 REACT_PROFILER_TYPE,
21 - REACT_PROVIDER_TYPE,
21 REACT_CONSUMER_TYPE,
22 REACT_STRICT_MODE_TYPE,
23 REACT_SUSPENSE_TYPE,
@@ -30,7 +29,6 @@ import {
29 } from 'shared/ReactSymbols';
30
31 import {
33 - enableRenderableContext,
32 enableScopeAPI,
33 enableTransitionTracing,
34 enableLegacyHidden,
@@ -64,14 +62,7 @@ export function typeOf(object: any): mixed {
62 case REACT_MEMO_TYPE:
63 return $$typeofType;
64 case REACT_CONSUMER_TYPE:
67 - if (enableRenderableContext) {
68 - return $$typeofType;
69 - }
70 - // Fall through
71 - case REACT_PROVIDER_TYPE:
72 - if (!enableRenderableContext) {
73 - return $$typeofType;
74 - }
65 + return $$typeofType;
66 // Fall through
67 default:
68 return $$typeof;
@@ -85,12 +76,8 @@ export function typeOf(object: any): mixed {
76 return undefined;
77 }
78
88 -export const ContextConsumer: symbol = enableRenderableContext
89 - ? REACT_CONSUMER_TYPE
90 - : REACT_CONTEXT_TYPE;
91 -export const ContextProvider: symbol = enableRenderableContext
92 - ? REACT_CONTEXT_TYPE
93 - : REACT_PROVIDER_TYPE;
79 +export const ContextConsumer: symbol = REACT_CONSUMER_TYPE;
80 +export const ContextProvider: symbol = REACT_CONTEXT_TYPE;
81 export const Element = REACT_ELEMENT_TYPE;
82 export const ForwardRef = REACT_FORWARD_REF_TYPE;
83 export const Fragment = REACT_FRAGMENT_TYPE;
@@ -127,8 +114,7 @@ export function isValidElementType(type: mixed): boolean {
114 type.$$typeof === REACT_LAZY_TYPE ||
115 type.$$typeof === REACT_MEMO_TYPE ||
116 type.$$typeof === REACT_CONTEXT_TYPE ||
130 - (!enableRenderableContext && type.$$typeof === REACT_PROVIDER_TYPE) ||
131 - (enableRenderableContext && type.$$typeof === REACT_CONSUMER_TYPE) ||
117 + type.$$typeof === REACT_CONSUMER_TYPE ||
118 type.$$typeof === REACT_FORWARD_REF_TYPE ||
119 // This needs to include all possible module reference object
120 // types supported by any Flight configuration anywhere since
@@ -145,18 +131,10 @@ export function isValidElementType(type: mixed): boolean {
131 }
132
133 export function isContextConsumer(object: any): boolean {
148 - if (enableRenderableContext) {
149 - return typeOf(object) === REACT_CONSUMER_TYPE;
150 - } else {
151 - return typeOf(object) === REACT_CONTEXT_TYPE;
152 - }
134 + return typeOf(object) === REACT_CONSUMER_TYPE;
135 }
136 export function isContextProvider(object: any): boolean {
155 - if (enableRenderableContext) {
156 - return typeOf(object) === REACT_CONTEXT_TYPE;
157 - } else {
158 - return typeOf(object) === REACT_PROVIDER_TYPE;
159 - }
137 + return typeOf(object) === REACT_CONTEXT_TYPE;
138 }
139 export function isElement(object: any): boolean {
140 return (
packages/react-reconciler/src/ReactFiber.js
+4 -19
@@ -41,7 +41,6 @@ import {
41 enableLegacyHidden,
42 enableTransitionTracing,
43 enableDO_NOT_USE_disableStrictPassiveEffect,
44 - enableRenderableContext,
44 disableLegacyMode,
45 enableObjectFiber,
46 enableViewTransition,
@@ -101,7 +100,6 @@ import {
100 REACT_FRAGMENT_TYPE,
101 REACT_STRICT_MODE_TYPE,
102 REACT_PROFILER_TYPE,
104 - REACT_PROVIDER_TYPE,
103 REACT_CONTEXT_TYPE,
104 REACT_CONSUMER_TYPE,
105 REACT_SUSPENSE_TYPE,
@@ -638,25 +636,12 @@ export function createFiberFromTypeAndProps(
636 default: {
637 if (typeof type === 'object' && type !== null) {
638 switch (type.$$typeof) {
641 - case REACT_PROVIDER_TYPE:
642 - if (!enableRenderableContext) {
643 - fiberTag = ContextProvider;
644 - break getTag;
645 - }
646 - // Fall through
639 case REACT_CONTEXT_TYPE:
648 - if (enableRenderableContext) {
649 - fiberTag = ContextProvider;
650 - break getTag;
651 - } else {
652 - fiberTag = ContextConsumer;
653 - break getTag;
654 - }
640 + fiberTag = ContextProvider;
641 + break getTag;
642 case REACT_CONSUMER_TYPE:
656 - if (enableRenderableContext) {
657 - fiberTag = ContextConsumer;
658 - break getTag;
659 - }
643 + fiberTag = ContextConsumer;
644 + break getTag;
645 // Fall through
646 case REACT_FORWARD_REF_TYPE:
647 fiberTag = ForwardRef;
packages/react-reconciler/src/ReactFiberBeginWork.js
+4 -25
@@ -116,7 +116,6 @@ import {
116 enableLegacyHidden,
117 enableCPUSuspense,
118 enablePostpone,
119 - enableRenderableContext,
119 disableLegacyMode,
120 disableDefaultPropsExceptForClasses,
121 enableHydrationLaneScheduling,
@@ -3591,12 +3590,7 @@ function updateContextProvider(
3590 workInProgress: Fiber,
3591 renderLanes: Lanes,
3592 ) {
3594 - let context: ReactContext<any>;
3595 - if (enableRenderableContext) {
3596 - context = workInProgress.type;
3597 - } else {
3598 - context = workInProgress.type._context;
3599 - }
3593 + const context: ReactContext<any> = workInProgress.type;
3594 const newProps = workInProgress.pendingProps;
3595 const newValue = newProps.value;
3596
@@ -3623,18 +3617,8 @@ function updateContextConsumer(
3617 workInProgress: Fiber,
3618 renderLanes: Lanes,
3619 ) {
3626 - let context: ReactContext<any>;
3627 - if (enableRenderableContext) {
3628 - const consumerType: ReactConsumerType<any> = workInProgress.type;
3629 - context = consumerType._context;
3630 - } else {
3631 - context = workInProgress.type;
3632 - if (__DEV__) {
3633 - if ((context: any)._context !== undefined) {
3634 - context = (context: any)._context;
3635 - }
3636 - }
3637 - }
3620 + const consumerType: ReactConsumerType<any> = workInProgress.type;
3621 + const context: ReactContext<any> = consumerType._context;
3622 const newProps = workInProgress.pendingProps;
3623 const render = newProps.children;
3624
@@ -3878,12 +3862,7 @@ function attemptEarlyBailoutIfNoScheduledUpdate(
3862 break;
3863 case ContextProvider: {
3864 const newValue = workInProgress.memoizedProps.value;
3881 - let context: ReactContext<any>;
3882 - if (enableRenderableContext) {
3883 - context = workInProgress.type;
3884 - } else {
3885 - context = workInProgress.type._context;
3886 - }
3865 + const context: ReactContext<any> = workInProgress.type;
3866 pushProvider(workInProgress, context, newValue);
3867 break;
3868 }
packages/react-reconciler/src/ReactFiberCompleteWork.js
+1 -7
@@ -38,7 +38,6 @@ import {
38 enablePersistedModeClonedFlag,
39 enableProfilerTimer,
40 enableTransitionTracing,
41 - enableRenderableContext,
41 passChildrenWhenCloningPersistedNodes,
42 disableLegacyMode,
43 enableViewTransition,
@@ -1667,12 +1666,7 @@ function completeWork(
1666 return null;
1667 case ContextProvider:
1668 // Pop provider fiber
1670 - let context: ReactContext<any>;
1671 - if (enableRenderableContext) {
1672 - context = workInProgress.type;
1673 - } else {
1674 - context = workInProgress.type._context;
1675 - }
1669 + const context: ReactContext<any> = workInProgress.type;
1670 popProvider(context, workInProgress);
1671 bubbleProperties(workInProgress);
1672 return null;
packages/react-reconciler/src/ReactFiberNewContext.js
+1 -8
@@ -29,7 +29,6 @@ import {
29 } from './ReactFiberFlags';
30
31 import is from 'shared/objectIs';
32 -import {enableRenderableContext} from 'shared/ReactFeatureFlags';
32 import {getHostTransitionProvider} from './ReactFiberHostContext';
33
34 const valueCursor: StackCursor<mixed> = createCursor(null);
@@ -389,13 +388,7 @@ function propagateParentContextChanges(
388
389 const oldProps = currentParent.memoizedProps;
390 if (oldProps !== null) {
392 - let context: ReactContext<any>;
393 - if (enableRenderableContext) {
394 - context = parent.type;
395 - } else {
396 - context = parent.type._context;
397 - }
398 -
391 + const context: ReactContext<any> = parent.type;
392 const newProps = parent.pendingProps;
393 const newValue = newProps.value;
394
packages/react-reconciler/src/ReactFiberScope.js
+2 -8
@@ -22,10 +22,7 @@ import {
22 import {isFiberSuspenseAndTimedOut} from './ReactFiberTreeReflection';
23
24 import {HostComponent, ScopeComponent, ContextProvider} from './ReactWorkTags';
25 -import {
26 - enableScopeAPI,
27 - enableRenderableContext,
28 -} from 'shared/ReactFeatureFlags';
25 +import {enableScopeAPI} from 'shared/ReactFeatureFlags';
26
27 function getSuspenseFallbackChild(fiber: Fiber): Fiber | null {
28 return ((((fiber.child: any): Fiber).sibling: any): Fiber).child;
@@ -116,10 +113,7 @@ function collectNearestContextValues<T>(
113 context: ReactContext<T>,
114 childContextValues: Array<T>,
115 ): void {
119 - if (
120 - node.tag === ContextProvider &&
121 - (enableRenderableContext ? node.type : node.type._context) === context
122 - ) {
116 + if (node.tag === ContextProvider && node.type === context) {
117 const contextValue = node.memoizedProps.value;
118 childContextValues.push(contextValue);
119 } else {
packages/react-reconciler/src/ReactFiberUnwindWork.js
+2 -13
@@ -36,7 +36,6 @@ import {NoMode, ProfileMode} from './ReactTypeOfMode';
36 import {
37 enableProfilerTimer,
38 enableTransitionTracing,
39 - enableRenderableContext,
39 } from 'shared/ReactFeatureFlags';
40
41 import {popHostContainer, popHostContext} from './ReactFiberHostContext';
@@ -189,12 +188,7 @@ function unwindWork(
188 popHostContainer(workInProgress);
189 return null;
190 case ContextProvider:
192 - let context: ReactContext<any>;
193 - if (enableRenderableContext) {
194 - context = workInProgress.type;
195 - } else {
196 - context = workInProgress.type._context;
197 - }
191 + const context: ReactContext<any> = workInProgress.type;
192 popProvider(context, workInProgress);
193 return null;
194 case OffscreenComponent:
@@ -286,12 +280,7 @@ function unwindInterruptedWork(
280 popSuspenseListContext(interruptedWork);
281 break;
282 case ContextProvider:
289 - let context: ReactContext<any>;
290 - if (enableRenderableContext) {
291 - context = interruptedWork.type;
292 - } else {
293 - context = interruptedWork.type._context;
294 - }
283 + const context: ReactContext<any> = interruptedWork.type;
284 popProvider(context, interruptedWork);
285 break;
286 case OffscreenComponent:
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
+2 -6
@@ -941,15 +941,11 @@ describe('ReactLazy', () => {
941 </Suspense>,
942 );
943 await waitForThrow(
944 - gate('enableRenderableContext')
945 - ? 'Element type is invalid. Received a promise that resolves to: Context.Provider. ' +
946 - 'Lazy element type must resolve to a class or function.'
947 - : 'Element type is invalid. Received a promise that resolves to: Context.Consumer. ' +
948 - 'Lazy element type must resolve to a class or function.',
944 + 'Element type is invalid. Received a promise that resolves to: Context.Provider. ' +
945 + 'Lazy element type must resolve to a class or function.',
946 );
947 });
948
952 - // @gate enableRenderableContext
949 it('throws with a useful error when wrapping Context.Consumer with lazy()', async () => {
950 const Context = React.createContext(null);
951 const BadLazy = lazy(() => fakeImport(Context.Consumer));
packages/react-reconciler/src/__tests__/ReactNewContext-test.js
-2
@@ -1358,7 +1358,6 @@ describe('ReactNewContext', () => {
1358 );
1359 });
1360
1361 - // @gate enableRenderableContext || !__DEV__
1361 it('warns when passed a consumer', async () => {
1362 const Context = React.createContext(0);
1363 function Foo() {
@@ -1657,7 +1656,6 @@ Context fuzz tester error! Copy and paste the following line into the test suite
1656 });
1657 });
1658
1660 - // @gate enableRenderableContext
1659 it('should treat Context as Context.Provider', async () => {
1660 const BarContext = React.createContext({value: 'bar-initial'});
1661 expect(BarContext.Provider).toBe(BarContext);
packages/react-reconciler/src/getComponentNameFromFiber.js
+4 -15
@@ -13,7 +13,6 @@ import type {Fiber} from './ReactInternalTypes';
13 import {
14 disableLegacyMode,
15 enableLegacyHidden,
16 - enableRenderableContext,
16 enableViewTransition,
17 } from 'shared/ReactFeatureFlags';
18
@@ -91,21 +90,11 @@ export default function getComponentNameFromFiber(fiber: Fiber): string | null {
90 case CacheComponent:
91 return 'Cache';
92 case ContextConsumer:
94 - if (enableRenderableContext) {
95 - const consumer: ReactConsumerType<any> = (type: any);
96 - return getContextName(consumer._context) + '.Consumer';
97 - } else {
98 - const context: ReactContext<any> = (type: any);
99 - return getContextName(context) + '.Consumer';
100 - }
93 + const consumer: ReactConsumerType<any> = (type: any);
94 + return getContextName(consumer._context) + '.Consumer';
95 case ContextProvider:
102 - if (enableRenderableContext) {
103 - const context: ReactContext<any> = (type: any);
104 - return getContextName(context) + '.Provider';
105 - } else {
106 - const provider = (type: any);
107 - return getContextName(provider._context) + '.Provider';
108 - }
96 + const context: ReactContext<any> = (type: any);
97 + return getContextName(context) + '.Provider';
98 case DehydratedFragment:
99 return 'DehydratedFragment';
100 case ForwardRef:
packages/react-server/src/ReactFizzServer.js
+7 -31
@@ -163,7 +163,6 @@ import {
163 REACT_FRAGMENT_TYPE,
164 REACT_FORWARD_REF_TYPE,
165 REACT_MEMO_TYPE,
166 - REACT_PROVIDER_TYPE,
166 REACT_CONTEXT_TYPE,
167 REACT_CONSUMER_TYPE,
168 REACT_SCOPE_TYPE,
@@ -178,7 +177,6 @@ import {
177 enableScopeAPI,
178 enablePostpone,
179 enableHalt,
181 - enableRenderableContext,
180 disableDefaultPropsExceptForClasses,
181 enableAsyncIterableChildren,
182 enableViewTransition,
@@ -2959,38 +2957,16 @@ function renderElement(
2957 renderMemo(request, task, keyPath, type, props, ref);
2958 return;
2959 }
2962 - case REACT_PROVIDER_TYPE: {
2963 - if (!enableRenderableContext) {
2964 - const context: ReactContext<any> = (type: any)._context;
2965 - renderContextProvider(request, task, keyPath, context, props);
2966 - return;
2967 - }
2968 - // Fall through
2969 - }
2960 case REACT_CONTEXT_TYPE: {
2971 - if (enableRenderableContext) {
2972 - const context = type;
2973 - renderContextProvider(request, task, keyPath, context, props);
2974 - return;
2975 - } else {
2976 - let context: ReactContext<any> = (type: any);
2977 - if (__DEV__) {
2978 - if ((context: any)._context !== undefined) {
2979 - context = (context: any)._context;
2980 - }
2981 - }
2982 - renderContextConsumer(request, task, keyPath, context, props);
2983 - return;
2984 - }
2961 + const context = type;
2962 + renderContextProvider(request, task, keyPath, context, props);
2963 + return;
2964 }
2965 case REACT_CONSUMER_TYPE: {
2987 - if (enableRenderableContext) {
2988 - const context: ReactContext<any> = (type: ReactConsumerType<any>)
2989 - ._context;
2990 - renderContextConsumer(request, task, keyPath, context, props);
2991 - return;
2992 - }
2993 - // Fall through
2966 + const context: ReactContext<any> = (type: ReactConsumerType<any>)
2967 + ._context;
2968 + renderContextConsumer(request, task, keyPath, context, props);
2969 + return;
2970 }
2971 case REACT_LAZY_TYPE: {
2972 renderLazyComponent(request, task, keyPath, type, props, ref);
packages/react/src/ReactContext.js
+6 -73
@@ -7,14 +7,9 @@
7 * @flow
8 */
9
10 -import {
11 - REACT_PROVIDER_TYPE,
12 - REACT_CONSUMER_TYPE,
13 - REACT_CONTEXT_TYPE,
14 -} from 'shared/ReactSymbols';
10 +import {REACT_CONSUMER_TYPE, REACT_CONTEXT_TYPE} from 'shared/ReactSymbols';
11
12 import type {ReactContext} from 'shared/ReactTypes';
17 -import {enableRenderableContext} from 'shared/ReactFeatureFlags';
13
14 export function createContext<T>(defaultValue: T): ReactContext<T> {
15 // TODO: Second argument used to be an optional `calculateChangedBits`
@@ -37,73 +32,11 @@ export function createContext<T>(defaultValue: T): ReactContext<T> {
32 Consumer: (null: any),
33 };
34
40 - if (enableRenderableContext) {
41 - context.Provider = context;
42 - context.Consumer = {
43 - $$typeof: REACT_CONSUMER_TYPE,
44 - _context: context,
45 - };
46 - } else {
47 - (context: any).Provider = {
48 - $$typeof: REACT_PROVIDER_TYPE,
49 - _context: context,
50 - };
51 - if (__DEV__) {
52 - const Consumer: any = {
53 - $$typeof: REACT_CONTEXT_TYPE,
54 - _context: context,
55 - };
56 - Object.defineProperties(Consumer, {
57 - Provider: {
58 - get() {
59 - return context.Provider;
60 - },
61 - set(_Provider: any) {
62 - context.Provider = _Provider;
63 - },
64 - },
65 - _currentValue: {
66 - get() {
67 - return context._currentValue;
68 - },
69 - set(_currentValue: T) {
70 - context._currentValue = _currentValue;
71 - },
72 - },
73 - _currentValue2: {
74 - get() {
75 - return context._currentValue2;
76 - },
77 - set(_currentValue2: T) {
78 - context._currentValue2 = _currentValue2;
79 - },
80 - },
81 - _threadCount: {
82 - get() {
83 - return context._threadCount;
84 - },
85 - set(_threadCount: number) {
86 - context._threadCount = _threadCount;
87 - },
88 - },
89 - Consumer: {
90 - get() {
91 - return context.Consumer;
92 - },
93 - },
94 - displayName: {
95 - get() {
96 - return context.displayName;
97 - },
98 - set(displayName: void | string) {},
99 - },
100 - });
101 - (context: any).Consumer = Consumer;
102 - } else {
103 - (context: any).Consumer = context;
104 - }
105 - }
106 -
35 + context.Provider = context;
36 + context.Consumer = {
37 + $$typeof: REACT_CONSUMER_TYPE,
38 + _context: context,
39 + };
40 if (__DEV__) {
41 context._currentRenderer = null;
42 context._currentRenderer2 = null;
packages/react/src/__tests__/ReactContextValidator-test.js
-1
@@ -490,7 +490,6 @@ describe('ReactContextValidator', () => {
490 ]);
491 });
492
493 - // @gate enableRenderableContext || !__DEV__
493 it('should warn if an invalid contextType is defined', async () => {
494 const Context = React.createContext();
495 class ComponentA extends React.Component {
packages/shared/ReactFeatureFlags.js
-3
@@ -204,9 +204,6 @@ export const enableReactTestRendererWarning = true;
204 // before removing them in stable in the next Major
205 export const disableLegacyMode = true;
206
207 -// Make <Context> equivalent to <Context.Provider> instead of <Context.Consumer>
208 -export const enableRenderableContext = true;
209 -
207 // -----------------------------------------------------------------------------
208 // Chopping Block
209 //
packages/shared/ReactSymbols.js
-1
@@ -22,7 +22,6 @@ export const REACT_PORTAL_TYPE: symbol = Symbol.for('react.portal');
22 export const REACT_FRAGMENT_TYPE: symbol = Symbol.for('react.fragment');
23 export const REACT_STRICT_MODE_TYPE: symbol = Symbol.for('react.strict_mode');
24 export const REACT_PROFILER_TYPE: symbol = Symbol.for('react.profiler');
25 -export const REACT_PROVIDER_TYPE: symbol = Symbol.for('react.provider'); // TODO: Delete with enableRenderableContext
25 export const REACT_CONSUMER_TYPE: symbol = Symbol.for('react.consumer');
26 export const REACT_CONTEXT_TYPE: symbol = Symbol.for('react.context');
27 export const REACT_FORWARD_REF_TYPE: symbol = Symbol.for('react.forward_ref');
packages/shared/forks/ReactFeatureFlags.native-fb.js
-1
@@ -58,7 +58,6 @@ export const enableProfilerCommitHooks = __PROFILE__;
58 export const enableProfilerNestedUpdatePhase = __PROFILE__;
59 export const enableProfilerTimer = __PROFILE__;
60 export const enableReactTestRendererWarning = false;
61 -export const enableRenderableContext = true;
61 export const enableRetryLaneExpiration = false;
62 export const enableSchedulingProfiler = __PROFILE__;
63 export const enableComponentPerformanceTrack = false;
packages/shared/forks/ReactFeatureFlags.native-oss.js
-1
@@ -43,7 +43,6 @@ export const enableObjectFiber = false;
43 export const enablePersistedModeClonedFlag = false;
44 export const enablePostpone = false;
45 export const enableReactTestRendererWarning = false;
46 -export const enableRenderableContext = true;
46 export const enableRetryLaneExpiration = false;
47 export const enableSchedulingProfiler = __PROFILE__;
48 export const enableComponentPerformanceTrack = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.js
-1
@@ -89,7 +89,6 @@ export const enableFragmentRefs = false;
89 export const disableLegacyMode = true;
90 export const disableLegacyContext = true;
91 export const disableLegacyContextForFunctionComponents = true;
92 -export const enableRenderableContext = true;
92 export const enableReactTestRendererWarning = true;
93 export const disableDefaultPropsExceptForClasses = true;
94
packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js
-1
@@ -41,7 +41,6 @@ export const enableProfilerCommitHooks = __PROFILE__;
41 export const enableProfilerNestedUpdatePhase = __PROFILE__;
42 export const enableProfilerTimer = __PROFILE__;
43 export const enableReactTestRendererWarning = false;
44 -export const enableRenderableContext = true;
44 export const enableRetryLaneExpiration = false;
45 export const enableSchedulingProfiler = __PROFILE__;
46 export const enableComponentPerformanceTrack = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
-1
@@ -38,7 +38,6 @@ export const enableUseEffectEventHook = false;
38 export const favorSafetyOverHydrationPerf = true;
39 export const enableLegacyFBSupport = false;
40 export const enableMoveBefore = false;
41 -export const enableRenderableContext = false;
41 export const enableHiddenSubtreeInsertionEffectCleanup = true;
42
43 export const enableRetryLaneExpiration = false;
packages/shared/forks/ReactFeatureFlags.www-dynamic.js
-1
@@ -21,7 +21,6 @@ export const enableDO_NOT_USE_disableStrictPassiveEffect = __VARIANT__;
21 export const enableHiddenSubtreeInsertionEffectCleanup = __VARIANT__;
22 export const enableNoCloningMemoCache = __VARIANT__;
23 export const enableObjectFiber = __VARIANT__;
24 -export const enableRenderableContext = __VARIANT__;
24 export const enableRetryLaneExpiration = __VARIANT__;
25 export const enableTransitionTracing = __VARIANT__;
26 export const favorSafetyOverHydrationPerf = __VARIANT__;
packages/shared/forks/ReactFeatureFlags.www.js
-1
@@ -24,7 +24,6 @@ export const {
24 enableInfiniteRenderLoopDetection,
25 enableNoCloningMemoCache,
26 enableObjectFiber,
27 - enableRenderableContext,
27 enableRetryLaneExpiration,
28 enableTransitionTracing,
29 enableTrustedTypesIntegration,
packages/shared/getComponentNameFromType.js
+3 -20
@@ -18,7 +18,6 @@ import {
18 REACT_PORTAL_TYPE,
19 REACT_MEMO_TYPE,
20 REACT_PROFILER_TYPE,
21 - REACT_PROVIDER_TYPE,
21 REACT_STRICT_MODE_TYPE,
22 REACT_SUSPENSE_TYPE,
23 REACT_SUSPENSE_LIST_TYPE,
@@ -30,7 +29,6 @@ import {
29
30 import {
31 enableTransitionTracing,
33 - enableRenderableContext,
32 enableViewTransition,
33 } from './ReactFeatureFlags';
34
@@ -106,27 +104,12 @@ export default function getComponentNameFromType(type: mixed): string | null {
104 switch (type.$$typeof) {
105 case REACT_PORTAL_TYPE:
106 return 'Portal';
109 - case REACT_PROVIDER_TYPE:
110 - if (enableRenderableContext) {
111 - return null;
112 - } else {
113 - const provider = (type: any);
114 - return getContextName(provider._context) + '.Provider';
115 - }
107 case REACT_CONTEXT_TYPE:
108 const context: ReactContext<any> = (type: any);
118 - if (enableRenderableContext) {
119 - return getContextName(context) + '.Provider';
120 - } else {
121 - return getContextName(context) + '.Consumer';
122 - }
109 + return getContextName(context) + '.Provider';
110 case REACT_CONSUMER_TYPE:
124 - if (enableRenderableContext) {
125 - const consumer: ReactConsumerType<any> = (type: any);
126 - return getContextName(consumer._context) + '.Consumer';
127 - } else {
128 - return null;
129 - }
111 + const consumer: ReactConsumerType<any> = (type: any);
112 + return getContextName(consumer._context) + '.Consumer';
113 case REACT_FORWARD_REF_TYPE:
114 return getWrappedName(type, type.render, 'ForwardRef');
115 case REACT_MEMO_TYPE: