File tree 2 files changed +5
-8
lines changed
2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change 1
1
import { Component } from 'react' ;
2
2
3
- import { Viewport } from './../graph/' ;
3
+ import { SVGRender , Viewport } from './../graph/' ;
4
4
import LoadingAnimation from './utils/LoadingAnimation' ;
5
5
6
+ const svgRenderer = new SVGRender ( ) ;
7
+
6
8
interface GraphViewportProps {
7
- svgRenderer : any ;
8
9
typeGraph : any ;
9
10
displayOptions : any ;
10
11
@@ -83,7 +84,7 @@ export default class GraphViewport extends Component<GraphViewportProps> {
83
84
this . _currentTypeGraph = typeGraph ;
84
85
this . _currentDisplayOptions = displayOptions ;
85
86
86
- const { svgRenderer , onSelectNode, onSelectEdge } = this . props ;
87
+ const { onSelectNode, onSelectEdge } = this . props ;
87
88
svgRenderer
88
89
. renderSvg ( typeGraph , displayOptions )
89
90
. then ( ( svg ) => {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import {
14
14
useState ,
15
15
} from 'react' ;
16
16
17
- import { getTypeGraph , SVGRender } from '../graph/' ;
17
+ import { getTypeGraph } from '../graph/' ;
18
18
import { extractTypeId , getSchema } from '../introspection' ;
19
19
import DocExplorer from './doc-explorer/DocExplorer' ;
20
20
import GraphViewport from './GraphViewport' ;
@@ -106,9 +106,6 @@ export default function Voyager(props: VoyagerProps) {
106
106
const viewportRef = useRef ( null ) ;
107
107
useEffect ( ( ) => viewportRef . current ?. resize ( ) , [ hideDocs ] ) ;
108
108
109
- // TODO: move into GraphViewport
110
- const svgRenderer = useMemo ( ( ) => new SVGRender ( ) , [ ] ) ;
111
-
112
109
return (
113
110
< ThemeProvider theme = { theme } >
114
111
< div className = "graphql-voyager" >
@@ -190,7 +187,6 @@ export default function Voyager(props: VoyagerProps) {
190
187
function renderGraphViewport ( ) {
191
188
return (
192
189
< GraphViewport
193
- svgRenderer = { svgRenderer }
194
190
typeGraph = { typeGraph }
195
191
displayOptions = { displayOptions }
196
192
selectedTypeID = { selected . typeID }
You can’t perform that action at this time.
0 commit comments