Home / Function/ SuspendedByGroup() — react Function Reference

SuspendedByGroup() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  1a0ee4d1_83f7_0dc1_4412_fcab95a7984d["SuspendedByGroup()"]
  72d570aa_3875_3688_0200_4617e04d04ed["InspectedElementSuspendedBy.js"]
  1a0ee4d1_83f7_0dc1_4412_fcab95a7984d -->|defined in| 72d570aa_3875_3688_0200_4617e04d04ed
  32c9cded_7802_2453_63ff_40e62addad6e["pluralize()"]
  1a0ee4d1_83f7_0dc1_4412_fcab95a7984d -->|calls| 32c9cded_7802_2453_63ff_40e62addad6e
  style 1a0ee4d1_83f7_0dc1_4412_fcab95a7984d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js lines 360–454

function SuspendedByGroup({
  bridge,
  element,
  inspectedElement,
  store,
  name,
  environment,
  suspendedBy,
  minTime,
  maxTime,
}: GroupProps) {
  const [isOpen, setIsOpen] = useState(false);
  let start = Infinity;
  let end = -Infinity;
  let isRejected = false;
  for (let i = 0; i < suspendedBy.length; i++) {
    const asyncInfo: SerializedAsyncInfo = suspendedBy[i].value;
    const ioInfo = asyncInfo.awaited;
    if (ioInfo.start < start) {
      start = ioInfo.start;
    }
    if (ioInfo.end > end) {
      end = ioInfo.end;
    }
    const value: any = ioInfo.value;
    if (
      value !== null &&
      typeof value === 'object' &&
      value[meta.name] === 'rejected Thenable'
    ) {
      isRejected = true;
    }
  }
  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 pluralizedName = pluralize(name);
  return (
    <div className={styles.CollapsableRow}>
      <Button
        className={styles.CollapsableHeader}
        onClick={() => {
          setIsOpen(prevIsOpen => !prevIsOpen);
        }}
        title={pluralizedName}>
        <ButtonIcon
          className={styles.CollapsableHeaderIcon}
          type={isOpen ? 'expanded' : 'collapsed'}
        />
        <span className={styles.CollapsableHeaderTitle}>{pluralizedName}</span>
        <div className={styles.CollapsableHeaderFiller} />
        {isOpen ? null : (
          <div
            className={
              styles.TimeBarContainer +
              ' ' +
              getClassNameForEnvironment(environment)
            }>
            <div
              className={
                !isRejected ? styles.TimeBarSpan : styles.TimeBarSpanErrored
              }
              style={{
                left: left.toFixed(2) + '%',
                width: width.toFixed(2) + '%',
              }}
            />
          </div>
        )}
      </Button>
      {isOpen &&
        suspendedBy.map(({value, index}) => (
          <SuspendedByRow
            key={index}

Domain

Subdomains

Calls

Frequently Asked Questions

What does SuspendedByGroup() do?
SuspendedByGroup() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js.
Where is SuspendedByGroup() defined?
SuspendedByGroup() is defined in packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js at line 360.
What does SuspendedByGroup() call?
SuspendedByGroup() calls 1 function(s): pluralize.

Analyze Your Own Codebase

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

Try Supermodel Free