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): clear container cache on focus, deprecate applyDagreLayout

Lum110409308631bce8
diff --git a/understand-anything-plugin/packages/dashboard/src/store.ts b/understand-anything-plugin/packages/dashboard/src/store.ts
index a8cfdf11..ec833d42 100644
--- a/understand-anything-plugin/packages/dashboard/src/store.ts
+++ b/understand-anything-plugin/packages/dashboard/src/store.ts
@@ -387,7 +387,17 @@ export const useDashboardStore = create<DashboardStore>()((set, get) => ({
expandedContainers: new Set(),
}),
- setFocusNode: (nodeId) => set({ focusNodeId: nodeId, selectedNodeId: nodeId }),
+ setFocusNode: (nodeId) =>
+ set({
+ focusNodeId: nodeId,
+ selectedNodeId: nodeId,
+ // Focus mode narrows filteredGraphNodes to focus + 1-hop; the
+ // surviving containers have a subset of their original children,
+ // and the cache must not return positions for filtered-out ids.
+ containerLayoutCache: new Map(),
+ containerSizeMemory: new Map(),
+ expandedContainers: new Set(),
+ }),
setSearchMode: (mode) => set({ searchMode: mode }),
setSearchQuery: (query) => {
const engine = get().searchEngine;
diff --git a/understand-anything-plugin/packages/dashboard/src/utils/layout.ts b/understand-anything-plugin/packages/dashboard/src/utils/layout.ts
index cd73fb66..b35328c5 100644
--- a/understand-anything-plugin/packages/dashboard/src/utils/layout.ts
+++ b/understand-anything-plugin/packages/dashboard/src/utils/layout.ts
@@ -21,6 +21,11 @@ export const PORTAL_NODE_HEIGHT = 80;
/**
* Synchronous dagre layout — used for small graphs.
+ *
+ * @deprecated The dashboard's structural views all use ELK now
+ * (`applyElkLayout` from `./elk-layout`). This helper is kept for one
+ * release to allow a quick fallback if ELK has a regression. Slated for
+ * removal in the version after layout migration is verified stable.
*/
export function applyDagreLayout(
nodes: Node[],