MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / wrappedComponent

Function wrappedComponent

src/resolution/frameworks/react.ts:850–858  ·  view source on GitHub ↗

* The component a value wraps, which is what it renders: the function it * holds (`const Application = observer(function Application() {…})`), or the * component of its own file a wrapper call is handed (`const TableView = * observer(TableViewInner)`). An inner function counts when it has the val

(value: Node, context: ResolutionContext)

Source from the content-addressed store, hash-verified

848 * has no node for (`withFallback('X', () => { const load = () => …; … })`).
849 */
850function wrappedComponent(value: Node, context: ResolutionContext): Node | null {
851 const nodes = context.getNodesInFile(value.filePath);
852 const inner = nodes.filter((n) => COMPONENT_KINDS.has(n.kind) &&
853 n.qualifiedName === `${value.qualifiedName}::${n.name}` && n.startLine >= value.startLine && n.endLine <= value.endLine);
854 const held = inner.find((n) => n.name === value.name) ??
855 (inner.length === 1 && inner[0]!.endLine === value.endLine ? inner[0]! : null);
856 if (held || inner.length > 0) return held;
857 return handedComponent(value, context, nodes);
858}
859
860/**
861 * The binding a value holds and nothing more — `AvatarWithHoverCard` of

Callers 2

exportedComponentFunction · 0.85
declaredComponentFunction · 0.85

Calls 3

handedComponentFunction · 0.85
hasMethod · 0.80
getNodesInFileMethod · 0.65

Tested by

no test coverage detected