Could not find suspense node id ${shellID}`);
+ return null;
+ }
+
+ return (
+
+ {shell.children.map(childID => {
+ return ;
+ })}
+
+ );
+}
+
+function SuspenseRectsContainer(): React$Node {
+ const store = useContext(StoreContext);
+ // TODO: This relies on a full re-render of all children when the Suspense tree changes.
+ const {shells} = useContext(SuspenseTreeStateContext);
+
+ const boundingRect = getDocumentBoundingRect(store, shells);
+
+ const width = '100%';
+ const boundingRectWidth = boundingRect.width;
+ const height =
+ (boundingRectWidth === 0 ? 0 : boundingRect.height / boundingRect.width) *
+ 100 +
+ '%';
+
+ return (
+
+
+
+ );
+}
+
+export default SuspenseRectsContainer;
diff --git a/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js b/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js
index d113fd3901f0c..dc0816bc2c285 100644
--- a/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js
+++ b/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js
@@ -19,6 +19,7 @@ import InspectedElementErrorBoundary from '../Components/InspectedElementErrorBo
import InspectedElement from '../Components/InspectedElement';
import portaledContent from '../portaledContent';
import styles from './SuspenseTab.css';
+import SuspenseRects from './SuspenseRects';
import SuspenseTreeList from './SuspenseTreeList';
import Button from '../Button';
@@ -48,10 +49,6 @@ function SuspenseTimeline() {
return timeline
;
}
-function SuspenseRects() {
- return rects
;
-}
-
function ToggleTreeList({
dispatch,
state,
diff --git a/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js b/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js
index 8441a994972cd..a16c93a4573e7 100644
--- a/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js
+++ b/packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js
@@ -17,9 +17,12 @@ import {
useMemo,
useReducer,
} from 'react';
+import type {SuspenseNode} from '../../../frontend/types';
import {StoreContext} from '../context';
-export type SuspenseTreeState = {};
+export type SuspenseTreeState = {
+ shells: $ReadOnlyArray,
+};
type ACTION_HANDLE_SUSPENSE_TREE_MUTATION = {
type: 'HANDLE_SUSPENSE_TREE_MUTATION',
@@ -56,7 +59,7 @@ function SuspenseTreeContextController({children}: Props): React.Node {
const {type} = action;
switch (type) {
case 'HANDLE_SUSPENSE_TREE_MUTATION':
- return {...state};
+ return {...state, shells: store.roots};
default:
throw new Error(`Unrecognized action "${type}"`);
}
@@ -64,7 +67,10 @@ function SuspenseTreeContextController({children}: Props): React.Node {
[],
);
- const [state, dispatch] = useReducer(reducer, {});
+ const initialState: SuspenseTreeState = {
+ shells: store.roots,
+ };
+ const [state, dispatch] = useReducer(reducer, initialState);
const transitionDispatch = useMemo(
() => (action: SuspenseTreeAction) =>
startTransition(() => {