Skip to content

Commit b6ffd02

Browse files
committed
Use new API methods of d3-dag library
1 parent f94f0f8 commit b6ffd02

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ui/components/DagGraph.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,19 @@ function DagGraph({ className, nodes }: Props) {
8383
const linkStrokeWidth = 5;
8484

8585
//use d3 to create DAG structure
86-
const stratify = d3d.dagStratify();
87-
const root = stratify(nodes);
86+
const builder = d3d.graphStratify();
87+
const graph = builder(nodes);
8888
const makeDag = d3d
8989
.sugiyama()
9090
.nodeSize(() => [
9191
nodeSize.width + nodeSize.horizontalSeparation,
9292
nodeSize.height + nodeSize.verticalSeparation,
9393
]);
94-
const { width } = makeDag(root);
95-
const descendants = root.descendants();
96-
const links = root.links();
94+
const { width } = makeDag(graph);
95+
const root = [...graph.roots()][0];
96+
97+
const descendants = root ? [...root.descendants()] : [];
98+
const links = [...graph.links()];
9799

98100
const graphOffsetX = zoomBox / 2 - width / 2;
99101
const verticalSeparationHalf = nodeSize.verticalSeparation / 2;

ui/components/ReconciliationGraph.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export const Graph = ({
137137
const handleMouseUp = () => {
138138
setIsPanning(false);
139139
};
140+
console.log('ReconciliationGraph');
140141
return (
141142
<Flex className={className} wide tall>
142143
<GraphDiv

0 commit comments

Comments
 (0)