|
1 | 1 | import * as React from "react"; |
2 | 2 | import { select } from "d3"; |
3 | 3 | import { jumpToLocation } from "./result-table-utils"; |
4 | | -import { |
5 | | - InterpretedResultSet, |
6 | | - GraphInterpretationData, |
7 | | -} from "../../common/interface-types"; |
8 | 4 | import { graphviz, GraphvizOptions } from "d3-graphviz"; |
9 | 5 | import { tryGetLocationFromString } from "../../common/bqrs-utils"; |
10 | 6 | import { useCallback, useEffect } from "react"; |
11 | | -export type GraphProps = { |
12 | | - resultSet: InterpretedResultSet<GraphInterpretationData>; |
13 | | - offset: number; |
| 7 | + |
| 8 | +type GraphProps = { |
| 9 | + graphData: string; |
14 | 10 | databaseUri: string; |
15 | 11 | }; |
16 | 12 |
|
17 | 13 | const graphClassName = "vscode-codeql__result-tables-graph"; |
18 | 14 | const graphId = "graph-results"; |
19 | 15 |
|
20 | | -export function Graph({ resultSet, offset, databaseUri }: GraphProps) { |
21 | | - const graphData = resultSet.interpretation?.data?.dot[offset]; |
22 | | - |
| 16 | +export function Graph({ graphData, databaseUri }: GraphProps) { |
23 | 17 | const renderGraph = useCallback(() => { |
24 | | - const graphData = resultSet.interpretation?.data?.dot[offset]; |
25 | | - |
26 | 18 | if (!graphData) { |
27 | 19 | return; |
28 | 20 | } |
@@ -76,7 +68,7 @@ export function Graph({ resultSet, offset, databaseUri }: GraphProps) { |
76 | 68 | } |
77 | 69 | }) |
78 | 70 | .renderDot(graphData); |
79 | | - }, [resultSet, offset, databaseUri]); |
| 71 | + }, [graphData, databaseUri]); |
80 | 72 |
|
81 | 73 | useEffect(() => { |
82 | 74 | renderGraph(); |
|
0 commit comments