Skip to content

Commit 6066c78

Browse files
authored
[DevTools] Dedicated empty state for roots that aren't suspended by anything (facebook#35769)
1 parent 705055d commit 6066c78

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
UNKNOWN_SUSPENDERS_REASON_OLD_VERSION,
3737
UNKNOWN_SUSPENDERS_REASON_THROWN_PROMISE,
3838
} from '../../../constants';
39+
import {ElementTypeRoot} from 'react-devtools-shared/src/frontend/types';
3940

4041
type RowProps = {
4142
bridge: FrontendBridge,
@@ -477,7 +478,21 @@ export default function InspectedElementSuspendedBy({
477478
</div>
478479
);
479480
}
480-
return null;
481+
// For roots, show an empty state since there's nothing else to show for
482+
// these elements.
483+
// This can happen for older versions of React without Suspense, older versions
484+
// of React with less sources for Suspense, or simple UIs that don't have any suspenders.
485+
if (inspectedElement.type === ElementTypeRoot) {
486+
return (
487+
<div>
488+
<div className={styles.HeaderRow}>
489+
<div className={`${styles.Header} ${styles.Empty}`}>
490+
Nothing suspended the initial paint.
491+
</div>
492+
</div>
493+
</div>
494+
);
495+
}
481496
}
482497

483498
const handleCopy = withPermissionsCheck(

0 commit comments

Comments
 (0)