MCPcopy Index your code
hub / github.com/react/react / describeDebugInfoFrame

Function describeDebugInfoFrame

packages/shared/ReactComponentStackFrame.js:43–62  ·  view source on GitHub ↗
(
  name: string,
  env: ?string,
  location: ?Error,
)

Source from the content-addressed store, hash-verified

41}
42
43export function describeDebugInfoFrame(
44 name: string,
45 env: ?string,
46 location: ?Error,
47): string {
48 if (location != null) {
49 // If we have a location, it's the child's owner stack. Treat the bottom most frame as
50 // the location of this function.
51 const childStack = formatOwnerStack(location);
52 const idx = childStack.lastIndexOf('\n');
53 const lastLine = idx === -1 ? childStack : childStack.slice(idx + 1);
54 if (lastLine.indexOf(name) !== -1) {
55 // For async stacks it's possible we don't have the owner on it. As a precaution only
56 // use this frame if it has the name of the function in it.
57 return '\n' + lastLine;
58 }
59 }
60
61 return describeBuiltInComponentFrame(name + (env ? ' [' + env + ']' : ''));
62}
63
64let reentry = false;
65let componentFrameCache;

Callers 2

Calls 2

formatOwnerStackFunction · 0.90

Tested by

no test coverage detected