Skip to content

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.

fix(dashboard): address 8 audit issues across dashboard components

Lum110420eb48319564
diff --git a/understand-anything-plugin/packages/dashboard/src/components/ExportMenu.tsx b/understand-anything-plugin/packages/dashboard/src/components/ExportMenu.tsx
index 5915ab4c..25c74233 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/ExportMenu.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/ExportMenu.tsx
@@ -181,8 +181,10 @@ export default function ExportMenu() {
try {
// Apply persona and filters to create filtered graph
+ // Non-technical persona: hide function/class sub-nodes, keep everything else
+ const subFileTypes = new Set(["function", "class"]);
let filteredGraphNodes = persona === "non-technical"
- ? graph.nodes.filter((n) => n.type === "concept" || n.type === "module" || n.type === "file")
+ ? graph.nodes.filter((n) => !subFileTypes.has(n.type))
: graph.nodes;
filteredGraphNodes = filterNodes(filteredGraphNodes, graph.layers ?? [], filters);
diff --git a/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx b/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx
index 3d86de63..82c4ce36 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/GraphView.tsx
@@ -99,7 +99,9 @@ function SelectedNodeFitView() {
useEffect(() => {
if (selectedNodeId && selectedNodeId !== prevRef.current) {
- requestAnimationFrame(() => {
+ // Delay slightly so this runs after any layer-level fitView triggered
+ // by navigateToNodeInLayer (which also changes activeLayerId).
+ const timer = setTimeout(() => {
fitView({
nodes: [{ id: selectedNodeId }],
duration: 500,
@@ -107,7 +109,9 @@ function SelectedNodeFitView() {
maxZoom: 1.2,
minZoom: 0.01,
});
- });
+ }, 100);
+ prevRef.current = selectedNodeId;
+ return () => clearTimeout(timer);
}
prevRef.current = selectedNodeId;
}, [selectedNodeId, fitView]);
@@ -244,21 +248,23 @@ function useLayerDetailTopology() {
}
}
- // All top-level (file-level) node types that should appear in the graph.
- // This includes the 8 new non-code types plus the original "file" type.
- const fileLevelTypes = new Set([
- "file", "config", "document", "service", "table",
+ // All node types visible at each persona level (single source of truth).
+ // Sub-file types (function, class) are only shown for junior/experienced.
+ const subFileTypes = new Set(["function", "class"]);
+ const allVisibleTypes = new Set([
+ "file", "module", "concept",
+ "config", "document", "service", "table",
"endpoint", "pipeline", "schema", "resource",
"domain", "flow", "step",
+ "function", "class",
]);
- // Non-technical persona: show module, concept, and file-level types (hide function/class)
- // Junior/experienced persona: show everything including function/class
- let filteredGraphNodes = persona === "non-technical"
- ? graph.nodes.filter(
- (n) => expandedLayerNodeIds.has(n.id) && (n.type === "concept" || n.type === "module" || fileLevelTypes.has(n.type)),
- )
- : graph.nodes.filter((n) => expandedLayerNodeIds.has(n.id) && (fileLevelTypes.has(n.type) || n.type === "module" || n.type === "concept" || n.type === "function" || n.type === "class"));
+ let filteredGraphNodes = graph.nodes.filter((n) => {
+ if (!expandedLayerNodeIds.has(n.id)) return false;
+ if (!allVisibleTypes.has(n.type)) return false;
+ if (persona === "non-technical" && subFileTypes.has(n.type)) return false;
+ return true;
+ });
// Apply node type category filters
filteredGraphNodes = filteredGraphNodes.filter((n) => {
diff --git a/understand-anything-plugin/packages/dashboard/src/components/PathFinderModal.tsx b/understand-anything-plugin/packages/dashboard/src/components/PathFinderModal.tsx
index 4f40d705..729a64b8 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/PathFinderModal.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/PathFinderModal.tsx
@@ -57,13 +57,18 @@ export default function PathFinderModal({ isOpen, onClose }: PathFinderModalProp
setSearching(true);
- // Build adjacency list
+ // Build adjacency list (bidirectional traversal for path finding)
const adjacency = new Map<string, string[]>();
for (const edge of edges) {
if (!adjacency.has(edge.source)) {
adjacency.set(edge.source, []);
}
adjacency.get(edge.source)!.push(edge.target);
+ // Also traverse in reverse so we can find paths through backward edges
+ if (!adjacency.has(edge.target)) {
+ adjacency.set(edge.target, []);
+ }
+ adjacency.get(edge.target)!.push(edge.source);
}
// BFS
diff --git a/understand-anything-plugin/packages/dashboard/src/components/ProjectOverview.tsx b/understand-anything-plugin/packages/dashboard/src/components/ProjectOverview.tsx
index ae799f13..439452bb 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/ProjectOverview.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/ProjectOverview.tsx
@@ -47,11 +47,12 @@ export default function ProjectOverview() {
// Category breakdowns
const categoryBreakdown = [
- { label: "Code", color: "var(--color-node-file)", count: (typeCounts["file"] ?? 0) + (typeCounts["function"] ?? 0) + (typeCounts["class"] ?? 0) },
+ { label: "Code", color: "var(--color-node-file)", count: (typeCounts["file"] ?? 0) + (typeCounts["function"] ?? 0) + (typeCounts["class"] ?? 0) + (typeCounts["module"] ?? 0) + (typeCounts["concept"] ?? 0) },
{ label: "Config", color: "var(--color-node-config)", count: typeCounts["config"] ?? 0 },
{ label: "Docs", color: "var(--color-node-document)", count: typeCounts["document"] ?? 0 },
{ label: "Infra", color: "var(--color-node-service)", count: (typeCounts["service"] ?? 0) + (typeCounts["resource"] ?? 0) + (typeCounts["pipeline"] ?? 0) },
{ label: "Data", color: "var(--color-node-table)", count: (typeCounts["table"] ?? 0) + (typeCounts["endpoint"] ?? 0) + (typeCounts["schema"] ?? 0) },
+ { label: "Domain", color: "var(--color-node-concept)", count: (typeCounts["domain"] ?? 0) + (typeCounts["flow"] ?? 0) + (typeCounts["step"] ?? 0) },
];
const hasNonCodeNodes = categoryBreakdown.some((c) => c.label !== "Code" && c.count > 0);
diff --git a/understand-anything-plugin/packages/dashboard/src/components/SearchBar.tsx b/understand-anything-plugin/packages/dashboard/src/components/SearchBar.tsx
index abc5eae3..27a1c94f 100644
--- a/understand-anything-plugin/packages/dashboard/src/components/SearchBar.tsx
+++ b/understand-anything-plugin/packages/dashboard/src/components/SearchBar.tsx
@@ -7,6 +7,17 @@ const typeBadgeColors: Record<string, string> = {
class: "text-node-class border border-node-class/30 bg-node-class/10",
module: "text-node-module border border-node-module/30 bg-node-module/10",
concept: "text-node-concept border border-node-concept/30 bg-node-concept/10",
+ config: "text-node-config border border-node-config/30 bg-node-config/10",
+ document: "text-node-document border border-node-document/30 bg-node-document/10",
+ service: "text-node-service border border-node-service/30 bg-node-service/10",
+ table: "text-node-table border border-node-table/30 bg-node-table/10",
+ endpoint: "text-node-endpoint border border-node-endpoint/30 bg-node-endpoint/10",
+ pipeline: "text-node-pipeline border border-node-pipeline/30 bg-node-pipeline/10",
+ schema: "text-node-schema border border-node-schema/30 bg-node-schema/10",
+ resource: "text-node-resource border border-node-resource/30 bg-node-resource/10",
+ domain: "text-node-concept border border-node-concept/30 bg-node-concept/10",
+ flow: "text-node-pipeline border border-node-pipeline/30 bg-node-pipeline/10",
+ step: "text-node-function border border-node-function/30 bg-node-function/10",
};
export default function SearchBar() {
diff --git a/understand-anything-plugin/packages/dashboard/src/store.ts b/understand-anything-plugin/packages/dashboard/src/store.ts
index 19e6e376..17bd31ee 100644
--- a/understand-anything-plugin/packages/dashboard/src/store.ts
+++ b/understand-anything-plugin/packages/dashboard/src/store.ts
@@ -11,7 +11,7 @@ export type Persona = "non-technical" | "junior" | "experienced";
export type NavigationLevel = "overview" | "layer-detail";
export type NodeType = "file" | "function" | "class" | "module" | "concept" | "config" | "document" | "service" | "table" | "endpoint" | "pipeline" | "schema" | "resource" | "domain" | "flow" | "step";
export type Complexity = "simple" | "moderate" | "complex";
-export type EdgeCategory = "structural" | "behavioral" | "data-flow" | "dependencies" | "semantic" | "domain";
+export type EdgeCategory = "structural" | "behavioral" | "data-flow" | "dependencies" | "semantic" | "infrastructure" | "domain";
export type ViewMode = "structural" | "domain";
export interface FilterState {
@@ -23,7 +23,7 @@ export interface FilterState {
export const ALL_NODE_TYPES: NodeType[] = ["file", "function", "class", "module", "concept", "config", "document", "service", "table", "endpoint", "pipeline", "schema", "resource", "domain", "flow", "step"];
export const ALL_COMPLEXITIES: Complexity[] = ["simple", "moderate", "complex"];
-export const ALL_EDGE_CATEGORIES: EdgeCategory[] = ["structural", "behavioral", "data-flow", "dependencies", "semantic", "domain"];
+export const ALL_EDGE_CATEGORIES: EdgeCategory[] = ["structural", "behavioral", "data-flow", "dependencies", "semantic", "infrastructure", "domain"];
export const EDGE_CATEGORY_MAP: Record<EdgeCategory, string[]> = {
structural: ["imports", "exports", "contains", "inherits", "implements"],
@@ -31,6 +31,7 @@ export const EDGE_CATEGORY_MAP: Record<EdgeCategory, string[]> = {
"data-flow": ["reads_from", "writes_to", "transforms", "validates"],
dependencies: ["depends_on", "tested_by", "configures"],
semantic: ["related", "similar_to"],
+ infrastructure: ["deploys", "serves", "provisions", "triggers", "migrates", "documents", "routes", "defines_schema"],
domain: ["contains_flow", "flow_step", "cross_domain"],
};
@@ -486,6 +487,7 @@ export const useDashboardStore = create<DashboardStore>()((set, get) => ({
? [...nodeHistory, selectedNodeId].slice(-MAX_HISTORY)
: nodeHistory;
set({
+ viewMode: "domain" as const,
activeDomainId: domainId,
focusNodeId: null,
nodeHistory: newHistory,