diff --git a/packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js b/packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js index 5596257fa5df5..08bba4f9da41f 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js @@ -17,7 +17,10 @@ import Button from '../Button'; import ButtonIcon from '../ButtonIcon'; import Icon from '../Icon'; import Toggle from '../Toggle'; -import {ElementTypeSuspense} from 'react-devtools-shared/src/frontend/types'; +import { + ElementTypeSuspense, + ElementTypeRoot, +} from 'react-devtools-shared/src/frontend/types'; import InspectedElementView from './InspectedElementView'; import {InspectedElementContext} from './InspectedElementContext'; import {getAlwaysOpenInEditor} from '../../../utils'; @@ -205,6 +208,16 @@ export default function InspectedElementWrapper(_: Props): React.Node { ); } + let fullName = element.displayName || ''; + if (element.nameProp !== null) { + fullName += ' "' + element.nameProp + '"'; + } + if (element.type === ElementTypeRoot) { + // The root only has "suspended by" and it represents the things that block + // Initial Paint. + fullName = 'Initial Paint'; + } + return (
- {element.displayName} + title={fullName}> + {fullName}
diff --git a/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseBreadcrumbs.js b/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseBreadcrumbs.js index b49d0b5eb9ad0..a9dcfc38f4214 100644 --- a/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseBreadcrumbs.js +++ b/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseBreadcrumbs.js @@ -25,7 +25,9 @@ export default function SuspenseBreadcrumbs(): React$Node { const store = useContext(StoreContext); const treeDispatch = useContext(TreeDispatcherContext); const suspenseTreeDispatch = useContext(SuspenseTreeDispatcherContext); - const {selectedSuspenseID, lineage} = useContext(SuspenseTreeStateContext); + const {selectedSuspenseID, selectedRootID, lineage} = useContext( + SuspenseTreeStateContext, + ); const {highlightHostInstance, clearHighlightHostInstance} = useHighlightHostInstance(); @@ -38,7 +40,24 @@ export default function SuspenseBreadcrumbs(): React$Node { return (
    - {lineage !== null && + {lineage === null ? null : lineage.length === 0 ? ( + // We selected the root. This means that we're currently viewing the Transition + // that rendered the whole screen. In laymans terms this is really "Initial Paint". + // TODO: Once we add subtree selection, then the equivalent should be called + // "Transition" since in that case it's really about a Transition within the page. + selectedRootID !== null ? ( +
  1. + +
  2. + ) : null + ) : ( lineage.map((id, index) => { const node = store.getSuspenseByID(id); @@ -57,7 +76,8 @@ export default function SuspenseBreadcrumbs(): React$Node { ); - })} + }) + )}
); }