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) <noreply@anthropic.com>
This commit is contained in:
Lum1104
2026-05-03 16:07:57 +08:00
Unverified
parent e459e924ff
commit 00a75c27db
@@ -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<string, string>;
}
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;