The dashboard dynamically imports `@fusion-plugin-examples/dependency-graph/dashboard-view`, which resolved through the plugin's package.json exports to `dist/`. When plugin source was edited without rebuilding, stale `dist/` (extensionless ESM imports) made the import throw and the UI surfaced "Bundled plugin view unavailable". Add vite/vitest aliases mapping the plugin (and its `/dashboard-view` subpath) to `src/` so the dashboard never depends on `dist/`. Mirrors the existing pattern for hermes/openclaw/paperclip runtimes. Also extends the runtime-plugin alias regression test, and emits `.js` extensions from the plugin source for the CLI-bundled path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
18 lines
603 B
TypeScript
18 lines
603 B
TypeScript
import { useMemo } from "react";
|
|
import type { Task } from "@fusion/core";
|
|
import type { GraphData, GraphNode } from "./types.js";
|
|
|
|
export function useGraphData(tasks: Task[]): GraphData {
|
|
return useMemo(() => {
|
|
const nodes: GraphNode[] = tasks.map((task) => ({ task }));
|
|
const taskIds = new Set(tasks.map((task) => task.id));
|
|
const edges = tasks.flatMap((task) =>
|
|
(task.dependencies ?? [])
|
|
.filter((dependencyId) => taskIds.has(dependencyId))
|
|
.map((dependencyId) => ({ source: task.id, target: dependencyId })),
|
|
);
|
|
|
|
return { nodes, edges };
|
|
}, [tasks]);
|
|
}
|