ProfilerSettings.js — react Source File
Architecture documentation for ProfilerSettings.js, a javascript file in the react codebase. 6 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 72d8a743_dd0b_d899_708b_6790db5d2e86["ProfilerSettings.js"] 315baf50_1028_51ca_a9c1_679c6a17ed98["hooks.js"] 72d8a743_dd0b_d899_708b_6790db5d2e86 --> 315baf50_1028_51ca_a9c1_679c6a17ed98 913bb343_55ea_f1b8_08f5_b75cb0a92b76["context.js"] 72d8a743_dd0b_d899_708b_6790db5d2e86 --> 913bb343_55ea_f1b8_08f5_b75cb0a92b76 3c0f989f_424c_e338_72c3_e8bc259ca04f["SettingsShared.css"] 72d8a743_dd0b_d899_708b_6790db5d2e86 --> 3c0f989f_424c_e338_72c3_e8bc259ca04f ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 72d8a743_dd0b_d899_708b_6790db5d2e86 --> ac587885_e294_a1e9_b13f_5e7b920fdb42 2c7da3cd_98d0_c6ad_5af9_31c875a0fa75["ProfilerContext"] 72d8a743_dd0b_d899_708b_6790db5d2e86 --> 2c7da3cd_98d0_c6ad_5af9_31c875a0fa75 ebb48597_9981_bb7d_08db_b9fe29a0f62e["SyntheticEvent"] 72d8a743_dd0b_d899_708b_6790db5d2e86 --> ebb48597_9981_bb7d_08db_b9fe29a0f62e 33c9bb39_5afe_7433_b39c_5c97384e3323["SettingsModal.js"] 33c9bb39_5afe_7433_b39c_5c97384e3323 --> 72d8a743_dd0b_d899_708b_6790db5d2e86 style 72d8a743_dd0b_d899_708b_6790db5d2e86 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import * as React from 'react';
import {useCallback, useContext, useMemo, useRef} from 'react';
import {useSubscription} from '../hooks';
import {StoreContext} from '../context';
import {ProfilerContext} from 'react-devtools-shared/src/devtools/views/Profiler/ProfilerContext';
import styles from './SettingsShared.css';
import typeof {SyntheticEvent} from 'react-dom-bindings/src/events/SyntheticEvent';
export default function ProfilerSettings(_: {}): React.Node {
const {
isCommitFilterEnabled,
minCommitDuration,
setIsCommitFilterEnabled,
setMinCommitDuration,
} = useContext(ProfilerContext);
const store = useContext(StoreContext);
const recordChangeDescriptionsSubscription = useMemo(
() => ({
getCurrentValue: () => store.recordChangeDescriptions,
subscribe: (callback: Function) => {
store.addListener('recordChangeDescriptions', callback);
return () => store.removeListener('recordChangeDescriptions', callback);
},
}),
[store],
);
const recordChangeDescriptions = useSubscription<boolean>(
recordChangeDescriptionsSubscription,
);
const updateRecordChangeDescriptions = useCallback(
({currentTarget}: $FlowFixMe) => {
store.recordChangeDescriptions = currentTarget.checked;
},
[store],
);
const updateMinCommitDuration = useCallback(
(event: SyntheticEvent) => {
const newValue = parseFloat(event.currentTarget.value);
setMinCommitDuration(
Number.isNaN(newValue) || newValue <= 0 ? 0 : newValue,
);
},
[setMinCommitDuration],
);
const updateIsCommitFilterEnabled = useCallback(
(event: SyntheticEvent) => {
const checked = event.currentTarget.checked;
setIsCommitFilterEnabled(checked);
if (checked) {
if (minCommitDurationInputRef.current !== null) {
minCommitDurationInputRef.current.focus();
}
}
},
[setIsCommitFilterEnabled],
);
const minCommitDurationInputRef = useRef<HTMLInputElement | null>(null);
return (
<div className={styles.SettingList}>
<div className={styles.SettingWrapper}>
<label className={styles.SettingRow}>
<input
type="checkbox"
checked={recordChangeDescriptions}
onChange={updateRecordChangeDescriptions}
className={styles.SettingRowCheckbox}
/>
Record why each component rendered while profiling
</label>
</div>
<div className={styles.SettingWrapper}>
<label className={styles.SettingRow}>
<input
checked={isCommitFilterEnabled}
onChange={updateIsCommitFilterEnabled}
type="checkbox"
className={styles.SettingRowCheckbox}
/>
Hide commits below
<input
className={styles.Input}
onChange={updateMinCommitDuration}
ref={minCommitDurationInputRef}
type="number"
value={minCommitDuration}
/>
(ms)
</label>
</div>
</div>
);
}
Domain
Subdomains
Functions
Dependencies
- ProfilerContext
- SettingsShared.css
- SyntheticEvent
- context.js
- hooks.js
- react
Source
Frequently Asked Questions
What does ProfilerSettings.js do?
ProfilerSettings.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ProfilerSettings.js?
ProfilerSettings.js defines 1 function(s): ProfilerSettings.
What does ProfilerSettings.js depend on?
ProfilerSettings.js imports 6 module(s): ProfilerContext, SettingsShared.css, SyntheticEvent, context.js, hooks.js, react.
What files import ProfilerSettings.js?
ProfilerSettings.js is imported by 1 file(s): SettingsModal.js.
Where is ProfilerSettings.js in the architecture?
ProfilerSettings.js is located at packages/react-devtools-shared/src/devtools/views/Settings/ProfilerSettings.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Settings).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free