feat(steps): draw all arms of conditional navigations as separate edges
Adds multi-arm navigation support: when a destination is produced by a conditional, every arm is now drawn as its own edge. Introduces helpers (hrefArms, destinationsForHref) and updates framework resolvers and edge creation to emit multiple navigates edges (via alsoTargets) instead of a single one. Also introduces per-app rooted route tables to avoid cross-app crossings, and updates various resolvers (React Router, TanStack Router, Vue Router, SvelteKit, Vue, and SvelteKit’s linker) and the UI to reflect multiple possible destinations. Tests and docs updated to reflect the new behavior, ensuring the Screens tab shows all possible navigation paths from conditional destinations. This makes navigation visualization more accurate for forked destinations.
This commit is contained in:
+12
-5
@@ -1061,7 +1061,7 @@ export class ReferenceResolver {
|
||||
* Create edges from resolved references
|
||||
*/
|
||||
createEdges(resolved: ResolvedRef[]): Edge[] {
|
||||
return resolved.map((ref) => {
|
||||
return resolved.flatMap((ref) => {
|
||||
// `function_ref` (#756) is internal-only: it persists as a `references`
|
||||
// edge (the registration site depends on the callback), distinguishable
|
||||
// by metadata.resolvedBy === 'function-ref'. callers/impact already
|
||||
@@ -1097,14 +1097,21 @@ export class ReferenceResolver {
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
// One reference can name several targets — a navigation whose
|
||||
// destination is a conditional reaches every arm. Each becomes its own
|
||||
// edge, sharing this resolution's kind and confidence.
|
||||
const targets = [
|
||||
{ targetNodeId: ref.targetNodeId, metadata: ref.metadata },
|
||||
...(ref.alsoTargets ?? []),
|
||||
];
|
||||
return targets.map((t) => ({
|
||||
source: ref.original.fromNodeId,
|
||||
target: ref.targetNodeId,
|
||||
target: t.targetNodeId,
|
||||
kind,
|
||||
line: ref.original.line,
|
||||
column: ref.original.column,
|
||||
metadata: {
|
||||
...(ref.metadata ?? {}),
|
||||
...(t.metadata ?? {}),
|
||||
confidence: ref.confidence,
|
||||
resolvedBy: ref.resolvedBy,
|
||||
// The ORIGINAL reference text (and kind, when edge-kind promotion
|
||||
@@ -1125,7 +1132,7 @@ export class ReferenceResolver {
|
||||
// exactly the edges this feature added.
|
||||
...(ref.original.referenceKind === 'function_ref' ? { fnRef: true } : {}),
|
||||
},
|
||||
};
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user