SuspenseTab() — react Function Reference
Architecture documentation for the SuspenseTab() function in SuspenseTab.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 8fa34834_c8ed_e954_92d8_678860d0b139["SuspenseTab()"] 3249b7c1_ae10_2672_10ce_a66fd0ee6f60["SuspenseTab.js"] 8fa34834_c8ed_e954_92d8_678860d0b139 -->|defined in| 3249b7c1_ae10_2672_10ce_a66fd0ee6f60 style 8fa34834_c8ed_e954_92d8_678860d0b139 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js lines 276–556
function SuspenseTab(_: {}) {
const store = useContext(StoreContext);
const {hideSettings} = useContext(OptionsContext);
const [state, dispatch] = useReducer<LayoutState, null, LayoutAction>(
layoutReducer,
null,
initLayoutState,
);
const {activities} = useContext(TreeStateContext);
// If there are no named Activity boundaries, we don't have any tree list and we should hide
// both the panel and the button to toggle it.
const activityListDisabled = !enableActivitySlices || activities.length === 0;
const wrapperTreeRef = useRef<null | HTMLElement>(null);
const resizeTreeRef = useRef<null | HTMLElement>(null);
const resizeActivityListRef = useRef<null | HTMLElement>(null);
// TODO: We'll show the recently inspected element in this tab when it should probably
// switch to the nearest Suspense boundary when we switch into this tab.
const {
inspectedElementHidden,
inspectedElementHorizontalFraction,
inspectedElementVerticalFraction,
activityListHidden,
activityListHorizontalFraction,
} = state;
useLayoutEffect(() => {
const wrapperElement = wrapperTreeRef.current;
setResizeCSSVariable(
wrapperElement,
'tree',
'horizontal',
inspectedElementHorizontalFraction * 100,
);
setResizeCSSVariable(
wrapperElement,
'tree',
'vertical',
inspectedElementVerticalFraction * 100,
);
const resizeActivityListElement = resizeActivityListRef.current;
setResizeCSSVariable(
resizeActivityListElement,
'activity-list',
'horizontal',
activityListHorizontalFraction * 100,
);
}, []);
useEffect(() => {
const timeoutID = setTimeout(() => {
localStorageSetItem(
LOCAL_STORAGE_KEY,
JSON.stringify({
inspectedElementHidden,
inspectedElementHorizontalFraction,
inspectedElementVerticalFraction,
activityListHidden,
activityListHorizontalFraction,
}),
);
}, 500);
return () => clearTimeout(timeoutID);
}, [
inspectedElementHidden,
inspectedElementHorizontalFraction,
inspectedElementVerticalFraction,
activityListHidden,
activityListHorizontalFraction,
]);
const onResizeStart = (event: SyntheticPointerEvent) => {
const element = event.currentTarget;
element.setPointerCapture(event.pointerId);
};
Domain
Subdomains
Source
Frequently Asked Questions
What does SuspenseTab() do?
SuspenseTab() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js.
Where is SuspenseTab() defined?
SuspenseTab() is defined in packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTab.js at line 276.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free