Home / Function/ getOwnerStackByComponentInfoInDev() — react Function Reference

getOwnerStackByComponentInfoInDev() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0d0f5eb3_f682_c269_a97f_22be22717aa0["getOwnerStackByComponentInfoInDev()"]
  aa545f4b_797f_d455_0d48_d21828047895["DevToolsComponentInfoStack.js"]
  0d0f5eb3_f682_c269_a97f_22be22717aa0 -->|defined in| aa545f4b_797f_d455_0d48_d21828047895
  5bd02f8e_960a_28df_cd57_8c68e5d3f04f["attach()"]
  5bd02f8e_960a_28df_cd57_8c68e5d3f04f -->|calls| 0d0f5eb3_f682_c269_a97f_22be22717aa0
  b79d7933_7e8b_53e4_29f2_b6516a60dac8["describeBuiltInComponentFrame()"]
  0d0f5eb3_f682_c269_a97f_22be22717aa0 -->|calls| b79d7933_7e8b_53e4_29f2_b6516a60dac8
  a8f4c31f_f504_975a_5ac7_bb83d1cf4164["formatOwnerStack()"]
  0d0f5eb3_f682_c269_a97f_22be22717aa0 -->|calls| a8f4c31f_f504_975a_5ac7_bb83d1cf4164
  style 0d0f5eb3_f682_c269_a97f_22be22717aa0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/backend/flight/DevToolsComponentInfoStack.js lines 21–55

export function getOwnerStackByComponentInfoInDev(
  componentInfo: ReactComponentInfo,
): string {
  try {
    let info = '';

    // The owner stack of the current component will be where it was created, i.e. inside its owner.
    // There's no actual name of the currently executing component. Instead, that is available
    // on the regular stack that's currently executing. However, if there is no owner at all, then
    // there's no stack frame so we add the name of the root component to the stack to know which
    // component is currently executing.
    if (!componentInfo.owner && typeof componentInfo.name === 'string') {
      return describeBuiltInComponentFrame(componentInfo.name);
    }

    let owner: void | null | ReactComponentInfo = componentInfo;

    while (owner) {
      const ownerStack: ?Error = owner.debugStack;
      if (ownerStack != null) {
        // Server Component
        owner = owner.owner;
        if (owner) {
          // TODO: Should we stash this somewhere for caching purposes?
          info += '\n' + formatOwnerStack(ownerStack);
        }
      } else {
        break;
      }
    }
    return info;
  } catch (x) {
    return '\nError generating stack: ' + x.message + '\n' + x.stack;
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getOwnerStackByComponentInfoInDev() do?
getOwnerStackByComponentInfoInDev() is a function in the react codebase, defined in packages/react-devtools-shared/src/backend/flight/DevToolsComponentInfoStack.js.
Where is getOwnerStackByComponentInfoInDev() defined?
getOwnerStackByComponentInfoInDev() is defined in packages/react-devtools-shared/src/backend/flight/DevToolsComponentInfoStack.js at line 21.
What does getOwnerStackByComponentInfoInDev() call?
getOwnerStackByComponentInfoInDev() calls 2 function(s): describeBuiltInComponentFrame, formatOwnerStack.
What calls getOwnerStackByComponentInfoInDev()?
getOwnerStackByComponentInfoInDev() is called by 1 function(s): attach.

Analyze Your Own Codebase

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

Try Supermodel Free