From 00a75c27dbb81a3b296c9f8aa2b90e1bdd3ce7da Mon Sep 17 00:00:00 2001 From: Lum1104 Date: Sun, 3 May 2026 16:07:57 +0800 Subject: [PATCH] chore(dashboard): address Task 5 review minors - Re-export NODE_WIDTH/NODE_HEIGHT from utils/layout.ts as the fallback dimensions in elk-layout.ts. Coupling them with the dagre/ force defaults prevents silent drift during the migration. - Declare optional x/y on ElkChild so downstream consumers (Tasks 9-12) see the position contract in the type. Comment notes ELK sets them on output but they're absent on input. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../packages/dashboard/src/utils/elk-layout.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/understand-anything-plugin/packages/dashboard/src/utils/elk-layout.ts b/understand-anything-plugin/packages/dashboard/src/utils/elk-layout.ts index d5181f3..8bc9f86 100644 --- a/understand-anything-plugin/packages/dashboard/src/utils/elk-layout.ts +++ b/understand-anything-plugin/packages/dashboard/src/utils/elk-layout.ts @@ -1,10 +1,14 @@ import ELK from "elkjs/lib/elk.bundled.js"; import type { GraphIssue } from "@understand-anything/core/schema"; +import { NODE_WIDTH, NODE_HEIGHT } from "./layout"; export interface ElkChild { id: string; width?: number; height?: number; + /** Set by ELK after layout; absent on input. Downstream consumers must default. */ + x?: number; + y?: number; children?: ElkChild[]; parentId?: string; } @@ -22,8 +26,11 @@ export interface ElkInput { layoutOptions?: Record; } -const DEFAULT_NODE_WIDTH = 280; -const DEFAULT_NODE_HEIGHT = 120; +// Keep ELK fallback dimensions in lockstep with the dagre/force NODE +// dimensions in utils/layout.ts so layouts stay collision-consistent +// during the migration. +const DEFAULT_NODE_WIDTH = NODE_WIDTH; +const DEFAULT_NODE_HEIGHT = NODE_HEIGHT; interface RepairOptions { strict?: boolean;