fix(dashboard): clear container cache on focus, deprecate applyDagreLayout

setFocusNode was missed in the C1 cache-reset pass. Focus mode narrows
filteredGraphNodes to focus + 1-hop neighbors, so a container that
survives still has a subset of its children — the cache must drop
or it'll keep returning positions for filtered-out ids.

Mark applyDagreLayout @deprecated. The structural views all use ELK
now; the helper is retained for one release as a quick fallback path
and removed in the next.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lum1104
2026-05-03 17:26:49 +08:00
Unverified
parent 8d068549cb
commit 09308631bc
2 changed files with 16 additions and 1 deletions
@@ -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;
@@ -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[],