ReloadAndProfileButton() — react Function Reference
Architecture documentation for the ReloadAndProfileButton() function in ReloadAndProfileButton.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD ab461c26_9cb1_e4e9_bbe0_113734c2b6bf["ReloadAndProfileButton()"] cfab091f_c28b_64cf_b7bc_c73383eec59f["ReloadAndProfileButton.js"] ab461c26_9cb1_e4e9_bbe0_113734c2b6bf -->|defined in| cfab091f_c28b_64cf_b7bc_c73383eec59f style ab461c26_9cb1_e4e9_bbe0_113734c2b6bf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-shared/src/devtools/views/Profiler/ReloadAndProfileButton.js lines 22–75
export default function ReloadAndProfileButton({
disabled,
}: {
disabled: boolean,
}): React.Node {
const bridge = useContext(BridgeContext);
const store = useContext(StoreContext);
const subscription = useMemo(
() => ({
getCurrentValue: () => ({
recordChangeDescriptions: store.recordChangeDescriptions,
supportsReloadAndProfile: store.supportsReloadAndProfile,
}),
subscribe: (callback: Function) => {
store.addListener('recordChangeDescriptions', callback);
store.addListener('supportsReloadAndProfile', callback);
return () => {
store.removeListener('recordChangeDescriptions', callback);
store.removeListener('supportsReloadAndProfile', callback);
};
},
}),
[store],
);
const {recordChangeDescriptions, supportsReloadAndProfile} =
useSubscription<SubscriptionData>(subscription);
const reloadAndProfile = useCallback(() => {
// TODO If we want to support reload-and-profile for e.g. React Native,
// we might need to also start profiling here before reloading the app (since DevTools itself isn't reloaded).
// We'd probably want to do this before reloading though, to avoid sending a message on a disconnected port in the browser.
// For now, let's just skip doing it entirely to avoid paying snapshot costs for data we don't need.
// startProfiling();
bridge.send('reloadAndProfile', {
recordChangeDescriptions,
recordTimeline: store.supportsTimeline,
});
}, [bridge, recordChangeDescriptions, store]);
if (!supportsReloadAndProfile) {
return null;
}
return (
<Button
disabled={disabled}
onClick={reloadAndProfile}
title="Reload and start profiling">
<ButtonIcon type="reload" />
</Button>
);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does ReloadAndProfileButton() do?
ReloadAndProfileButton() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/Profiler/ReloadAndProfileButton.js.
Where is ReloadAndProfileButton() defined?
ReloadAndProfileButton() is defined in packages/react-devtools-shared/src/devtools/views/Profiler/ReloadAndProfileButton.js at line 22.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free