Home / Function/ CommitFlamegraphAutoSizer() — react Function Reference

CommitFlamegraphAutoSizer() — react Function Reference

Architecture documentation for the CommitFlamegraphAutoSizer() function in CommitFlamegraph.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  36535162_88b3_c78c_b6b5_fb6af7abf6e9["CommitFlamegraphAutoSizer()"]
  54e7a598_e83a_4b14_3104_1fa62a034c31["CommitFlamegraph.js"]
  36535162_88b3_c78c_b6b5_fb6af7abf6e9 -->|defined in| 54e7a598_e83a_4b14_3104_1fa62a034c31
  style 36535162_88b3_c78c_b6b5_fb6af7abf6e9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/Profiler/CommitFlamegraph.js lines 41–90

export default function CommitFlamegraphAutoSizer(_: {}): React.Node {
  const {profilerStore} = useContext(StoreContext);
  const {rootID, selectedCommitIndex, selectFiber} =
    useContext(ProfilerContext);
  const {profilingCache} = profilerStore;

  const deselectCurrentFiber = useCallback(
    (event: $FlowFixMe) => {
      event.stopPropagation();
      selectFiber(null, null);
    },
    [selectFiber],
  );

  let commitTree: CommitTree | null = null;
  let chartData: ChartData | null = null;
  if (selectedCommitIndex !== null) {
    commitTree = profilingCache.getCommitTree({
      commitIndex: selectedCommitIndex,
      rootID: ((rootID: any): number),
    });

    chartData = profilingCache.getFlamegraphChartData({
      commitIndex: selectedCommitIndex,
      commitTree,
      rootID: ((rootID: any): number),
    });
  }

  if (commitTree != null && chartData != null && chartData.depth > 0) {
    return (
      <div className={styles.Container} onClick={deselectCurrentFiber}>
        <AutoSizer>
          {({height, width}) => (
            // Force Flow types to avoid checking for `null` here because there's no static proof that
            // by the time this render prop function is called, the values of the `let` variables have not changed.
            <CommitFlamegraph
              chartData={((chartData: any): ChartData)}
              commitTree={((commitTree: any): CommitTree)}
              height={height}
              width={width}
            />
          )}
        </AutoSizer>
      </div>
    );
  } else {
    return <NoCommitData />;
  }
}

Domain

Subdomains

Frequently Asked Questions

What does CommitFlamegraphAutoSizer() do?
CommitFlamegraphAutoSizer() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/Profiler/CommitFlamegraph.js.
Where is CommitFlamegraphAutoSizer() defined?
CommitFlamegraphAutoSizer() is defined in packages/react-devtools-shared/src/devtools/views/Profiler/CommitFlamegraph.js at line 41.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free