File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
packages/react-devtools-shared/src/devtools/views/Components Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,21 @@ function SuspendedByRow({
8181} : RowProps ) {
8282 const [ isOpen , setIsOpen ] = useState ( false ) ;
8383 const ioInfo = asyncInfo . awaited ;
84- const name = ioInfo . name ;
84+ let name = ioInfo . name ;
85+ if ( name === '' || name === 'Promise' ) {
86+ // If all we have is a generic name, we can try to infer a better name from
87+ // the stack. We only do this if the stack has more than one frame since
88+ // otherwise it's likely to just be the name of the component which isn't better.
89+ const bestStack = ioInfo . stack || asyncInfo . stack ;
90+ if ( bestStack !== null && bestStack . length > 1 ) {
91+ // TODO: Ideally we'd get the name from the last ignore listed frame before the
92+ // first visible frame since this is the same algorithm as the Flight server uses.
93+ // Ideally, we'd also get the name from the source mapped entry instead of the
94+ // original entry. However, that would require suspending the immediate display
95+ // of these rows to first do source mapping before we can show the name.
96+ name = bestStack [ 0 ] [ 0 ] ;
97+ }
98+ }
8599 const description = ioInfo . description ;
86100 const longName = description === '' ? name : name + ' (' + description + ')' ;
87101 const shortDescription = getShortDescription ( name , description ) ;
You can’t perform that action at this time.
0 commit comments