Stringify context as SomeContext instead of SomeContext.Provider (#33507)

This matches the change in React 19 to use `<SomeContext>` as the
preferred way to provide a context.
This commit is contained in:
Jan Kassens
2025-06-11 12:08:04 -04:00
committed by GitHub
parent ff93c4448c
commit b7e2de632b
3 changed files with 3 additions and 3 deletions

View File

@@ -941,7 +941,7 @@ describe('ReactLazy', () => {
</Suspense>,
);
await waitForThrow(
'Element type is invalid. Received a promise that resolves to: Context.Provider. ' +
'Element type is invalid. Received a promise that resolves to: Context. ' +
'Lazy element type must resolve to a class or function.',
);
});

View File

@@ -94,7 +94,7 @@ export default function getComponentNameFromFiber(fiber: Fiber): string | null {
return getContextName(consumer._context) + '.Consumer';
case ContextProvider:
const context: ReactContext<any> = (type: any);
return getContextName(context) + '.Provider';
return getContextName(context);
case DehydratedFragment:
return 'DehydratedFragment';
case ForwardRef:

View File

@@ -106,7 +106,7 @@ export default function getComponentNameFromType(type: mixed): string | null {
return 'Portal';
case REACT_CONTEXT_TYPE:
const context: ReactContext<any> = (type: any);
return getContextName(context) + '.Provider';
return getContextName(context);
case REACT_CONSUMER_TYPE:
const consumer: ReactConsumerType<any> = (type: any);
return getContextName(consumer._context) + '.Consumer';