Home / Function/ CommitRankedListItem() — react Function Reference

CommitRankedListItem() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  bb5ba7dd_ac69_1751_9057_760848df67b4["CommitRankedListItem()"]
  89b916c8_640c_20f1_5b9e_9022ade373b8["CommitRankedListItem.js"]
  bb5ba7dd_ac69_1751_9057_760848df67b4 -->|defined in| 89b916c8_640c_20f1_5b9e_9022ade373b8
  style bb5ba7dd_ac69_1751_9057_760848df67b4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/Profiler/CommitRankedListItem.js lines 26–80

function CommitRankedListItem({data, index, style}: Props) {
  const {
    chartData,
    onElementMouseEnter,
    onElementMouseLeave,
    scaleX,
    selectedFiberIndex,
    selectFiber,
    width,
  } = data;

  const node = chartData.nodes[index];

  const {lineHeight} = useContext(SettingsContext);

  const handleClick = useCallback(
    (event: $FlowFixMe) => {
      event.stopPropagation();
      const {id, name} = node;
      selectFiber(id, name);
    },
    [node, selectFiber],
  );

  const handleMouseEnter = () => {
    const {id, name} = node;
    onElementMouseEnter({id, name});
  };

  const handleMouseLeave = () => {
    onElementMouseLeave();
  };

  // List items are absolutely positioned using the CSS "top" attribute.
  // The "left" value will always be 0.
  // Since height is fixed, and width is based on the node's duration,
  // We can ignore those values as well.
  const top = parseInt(style.top, 10);

  return (
    <ChartNode
      color={getGradientColor(node.value / chartData.maxValue)}
      height={lineHeight}
      isDimmed={index < selectedFiberIndex}
      key={node.id}
      label={node.label}
      onClick={handleClick}
      onMouseEnter={handleMouseEnter}
      onMouseLeave={handleMouseLeave}
      width={Math.max(minBarWidth, scaleX(node.value, width))}
      x={0}
      y={top}
    />
  );
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free