File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import {
44
44
LegacyHiddenComponent ,
45
45
CacheComponent ,
46
46
TracingMarkerComponent ,
47
+ Throw ,
47
48
} from 'react-reconciler/src/ReactWorkTags' ;
48
49
import getComponentNameFromType from 'shared/getComponentNameFromType' ;
49
50
import { REACT_STRICT_MODE_TYPE } from 'shared/ReactSymbols' ;
@@ -160,6 +161,26 @@ export default function getComponentNameFromFiber(fiber: Fiber): string | null {
160
161
if ( enableLegacyHidden ) {
161
162
return 'LegacyHidden ';
162
163
}
164
+ break ;
165
+ case Throw : {
166
+ if ( __DEV__ ) {
167
+ // For an error in child position we use the of the inner most parent component.
168
+ // Whether a Server Component or the parent Fiber.
169
+ const debugInfo = fiber . _debugInfo ;
170
+ if ( debugInfo != null ) {
171
+ for ( let i = debugInfo . length - 1 ; i >= 0 ; i -- ) {
172
+ if ( typeof debugInfo [ i ] . name === 'string' ) {
173
+ return debugInfo [ i ] . name ;
174
+ }
175
+ }
176
+ }
177
+ if ( fiber . return === null ) {
178
+ return null ;
179
+ }
180
+ return getComponentNameFromFiber ( fiber . return ) ;
181
+ }
182
+ return null ;
183
+ }
163
184
}
164
185
165
186
return null ;
You can’t perform that action at this time.
0 commit comments