Home / Function/ extractLocationFromOwnerStack() — react Function Reference

extractLocationFromOwnerStack() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3bf3e90e_51d6_910a_d710_2cbd2bff3d49["extractLocationFromOwnerStack()"]
  c70671e1_42cb_8c92_da33_5303a72f89b1["parseStackTrace.js"]
  3bf3e90e_51d6_910a_d710_2cbd2bff3d49 -->|defined in| c70671e1_42cb_8c92_da33_5303a72f89b1
  46b4ae1b_01e7_57f6_d691_ef43e922cf3b["parseStackTrace()"]
  3bf3e90e_51d6_910a_d710_2cbd2bff3d49 -->|calls| 46b4ae1b_01e7_57f6_d691_ef43e922cf3b
  style 3bf3e90e_51d6_910a_d710_2cbd2bff3d49 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/backend/utils/parseStackTrace.js lines 319–346

export function extractLocationFromOwnerStack(
  error: Error,
): ReactFunctionLocation | null {
  const stackTrace = parseStackTrace(error, 1);
  const stack = error.stack;
  if (
    !stack.includes('react_stack_bottom_frame') &&
    !stack.includes('react-stack-bottom-frame')
  ) {
    // This didn't have a bottom to it, we can't trust it.
    return null;
  }
  // We start from the bottom since that will have the best location for the owner itself.
  for (let i = stackTrace.length - 1; i >= 0; i--) {
    const [functionName, fileName, line, col, encLine, encCol] = stackTrace[i];
    // Take the first match with a colon in the file name.
    if (fileName.indexOf(':') !== -1) {
      return [
        functionName,
        fileName,
        // Use enclosing line if available, since that points to the start of the function.
        encLine || line,
        encCol || col,
      ];
    }
  }
  return null;
}

Domain

Subdomains

Frequently Asked Questions

What does extractLocationFromOwnerStack() do?
extractLocationFromOwnerStack() is a function in the react codebase, defined in packages/react-devtools-shared/src/backend/utils/parseStackTrace.js.
Where is extractLocationFromOwnerStack() defined?
extractLocationFromOwnerStack() is defined in packages/react-devtools-shared/src/backend/utils/parseStackTrace.js at line 319.
What does extractLocationFromOwnerStack() call?
extractLocationFromOwnerStack() calls 1 function(s): parseStackTrace.

Analyze Your Own Codebase

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

Try Supermodel Free