Home / Function/ SuspendedByRow() — react Function Reference

SuspendedByRow() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  5645a00e_3d63_a610_d80b_45ac1c4f677b["SuspendedByRow()"]
  72d570aa_3875_3688_0200_4617e04d04ed["InspectedElementSuspendedBy.js"]
  5645a00e_3d63_a610_d80b_45ac1c4f677b -->|defined in| 72d570aa_3875_3688_0200_4617e04d04ed
  18f77603_66a3_a0b7_fc32_15685475171d["useInferredName()"]
  5645a00e_3d63_a610_d80b_45ac1c4f677b -->|calls| 18f77603_66a3_a0b7_fc32_15685475171d
  4a021af0_9b90_d463_66c0_d7f26ff97208["getShortDescription()"]
  5645a00e_3d63_a610_d80b_45ac1c4f677b -->|calls| 4a021af0_9b90_d463_66c0_d7f26ff97208
  a828885a_845c_2fca_22ab_4da5b58a3c10["formatBytes()"]
  5645a00e_3d63_a610_d80b_45ac1c4f677b -->|calls| a828885a_845c_2fca_22ab_4da5b58a3c10
  style 5645a00e_3d63_a610_d80b_45ac1c4f677b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js lines 96–305

function SuspendedByRow({
  bridge,
  element,
  inspectedElement,
  store,
  asyncInfo,
  index,
  minTime,
  maxTime,
  skipName,
}: RowProps) {
  const [isOpen, setIsOpen] = useState(false);
  const [openIsPending, startOpenTransition] = useTransition();
  const ioInfo = asyncInfo.awaited;
  const name = useInferredName(asyncInfo);
  const description = ioInfo.description;
  const longName = description === '' ? name : name + ' (' + description + ')';
  const shortDescription = getShortDescription(name, description);
  const start = ioInfo.start;
  const end = ioInfo.end;
  const timeScale = 100 / (maxTime - minTime);
  let left = (start - minTime) * timeScale;
  let width = (end - start) * timeScale;
  if (width < 5) {
    // Use at least a 5% width to avoid showing too small indicators.
    width = 5;
    if (left > 95) {
      left = 95;
    }
  }

  const ioOwner = ioInfo.owner;
  const asyncOwner = asyncInfo.owner;
  const showIOStack = ioInfo.stack !== null && ioInfo.stack.length !== 0;
  // Only show the awaited stack if the I/O started in a different owner
  // than where it was awaited. If it's started by the same component it's
  // probably easy enough to infer and less noise in the common case.
  const canShowAwaitStack =
    (asyncInfo.stack !== null && asyncInfo.stack.length > 0) ||
    (asyncOwner !== null && asyncOwner.id !== inspectedElement.id);
  const showAwaitStack =
    canShowAwaitStack &&
    (!showIOStack ||
      (ioOwner === null
        ? asyncOwner !== null
        : asyncOwner === null || ioOwner.id !== asyncOwner.id));

  const value: any = ioInfo.value;
  const metaName =
    value !== null && typeof value === 'object' ? value[meta.name] : null;
  const isFulfilled = metaName === 'fulfilled Thenable';
  const isRejected = metaName === 'rejected Thenable';
  return (
    <div className={styles.CollapsableRow}>
      <Button
        className={styles.CollapsableHeader}
        // TODO: May be better to leave to React's default Transition indicator.
        // Though no apps implement this option at the moment.
        data-pending={openIsPending}
        onClick={() => {
          startOpenTransition(() => {
            setIsOpen(prevIsOpen => !prevIsOpen);
          });
        }}
        // Changing the title on pending transition will not be visible since
        // (Reach?) tooltips are dismissed on activation.
        title={
          longName +
          ' — ' +
          (end - start).toFixed(2) +
          ' ms' +
          (ioInfo.byteSize != null ? ' — ' + formatBytes(ioInfo.byteSize) : '')
        }>
        <ButtonIcon
          className={styles.CollapsableHeaderIcon}
          type={isOpen ? 'expanded' : 'collapsed'}
        />
        <span className={styles.CollapsableHeaderTitle}>
          {skipName && shortDescription !== '' ? shortDescription : name}
        </span>
        {skipName || shortDescription === '' ? null : (

Domain

Subdomains

Frequently Asked Questions

What does SuspendedByRow() do?
SuspendedByRow() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js.
Where is SuspendedByRow() defined?
SuspendedByRow() is defined in packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js at line 96.
What does SuspendedByRow() call?
SuspendedByRow() calls 3 function(s): formatBytes, getShortDescription, useInferredName.

Analyze Your Own Codebase

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

Try Supermodel Free