diff --git a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
index 0827816b2b..6511d22e60 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
@@ -1576,6 +1576,30 @@ describe('ReactSuspense', () => {
span('C'),
]);
});
+
+ it('includes lazy-loaded component in warning stack', async () => {
+ const LazyFoo = lazy(() => {
+ ReactNoop.yield('Started loading');
+ const Foo = props => (
+
{[, ]}
+ );
+ return Promise.resolve(Foo);
+ });
+
+ ReactNoop.render(
+ }>
+
+ ,
+ );
+ expect(ReactNoop.flush()).toEqual(['Started loading', 'Loading...']);
+ expect(ReactNoop.getChildren()).toEqual([]);
+
+ await LazyFoo;
+ expect(() => {
+ expect(ReactNoop.flush()).toEqual(['A', 'B']);
+ }).toWarnDev(' in Text (at **)\n' + ' in Foo (at **)');
+ expect(ReactNoop.getChildren()).toEqual([div(span('A'), span('B'))]);
+ });
});
it('does not call lifecycles of a suspended component', async () => {
diff --git a/packages/shared/getComponentName.js b/packages/shared/getComponentName.js
index e5b39b33c4..558f00c1a0 100644
--- a/packages/shared/getComponentName.js
+++ b/packages/shared/getComponentName.js
@@ -21,10 +21,7 @@ import {
REACT_STRICT_MODE_TYPE,
REACT_PLACEHOLDER_TYPE,
} from 'shared/ReactSymbols';
-import {
- getResultFromResolvedThenable,
- refineResolvedThenable,
-} from 'shared/ReactLazyComponent';
+import {refineResolvedThenable} from 'shared/ReactLazyComponent';
function getComponentName(type: mixed): string | null {
if (type == null) {
@@ -77,8 +74,7 @@ function getComponentName(type: mixed): string | null {
const thenable: Thenable = (type: any);
const resolvedThenable = refineResolvedThenable(thenable);
if (resolvedThenable) {
- const Component = getResultFromResolvedThenable(resolvedThenable);
- return getComponentName(Component);
+ return getComponentName(resolvedThenable);
}
}
}