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

Function firedByEffect

src/ui-server/api/steps.ts:732–751  ·  view source on GitHub ↗
(fnId: string, at: { line?: number; column?: number }, of: string)

Source from the content-addressed store, hash-verified

730 Array<{ start: { line: number; column: number }; end: { line: number; column: number }; step: StepRecord }>
731 >();
732 const firedByEffect = (fnId: string, at: { line?: number; column?: number }, of: string): StepRecord | null => {
733 if (at.line === undefined) return null;
734 const spans = firedSpans.get(fnId);
735 if (!spans) return null;
736 const last = (n: string) => n.replace(/\([^()]*\)/g, '').split(/[.:]/).pop() ?? n;
737 const want = last(of);
738 const line = at.line;
739 const column = at.column ?? 0;
740 let best: (typeof spans)[number] | null = null;
741 for (const s of spans) {
742 if (line < s.start.line || line > s.end.line) continue;
743 if (line === s.start.line && column < s.start.column) continue;
744 if (line === s.end.line && column > s.end.column) continue;
745 if (!s.step.effect?.apis.some((api) => last(api) === want)) continue;
746 if (best === null || s.start.line > best.start.line || (s.start.line === best.start.line && s.start.column > best.start.column)) {
747 best = s;
748 }
749 }
750 return best?.step ?? null;
751 };
752
753 const stepFor = (node: Node, kind: WireStepKind, depth: number, extra: Partial<WireStep> = {}): StepRecord | null => {
754 const existing = steps.get(node.id);

Callers 2

effectLinkFunction · 0.85
buildStepsFunction · 0.85

Calls 2

lastFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected