Skip to content

Commit ae3244c

Browse files
author
Omri Hopson
committed
fix explorer raw data
1 parent 6abea7c commit ae3244c

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

dashboard/src/pages/Explorer/Explorer.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,20 @@ export default function Explorer() {
115115
}, [selectedRepo]);
116116

117117
useEffect(() => {
118-
if (!containerRef.current || !selectedRepo) return;
118+
if (!selectedRepo) return;
119119

120120
setLoading(true);
121121

122122
fetch(`/api/graph/${selectedRepo}?maxNodes=500&includeEdges=true`)
123123
.then(res => res.json())
124124
.then((data: GraphData) => {
125-
if (!containerRef.current) return;
126125
setRawData(data);
126+
setGraphStats({ nodes: data.nodes.length, edges: data.edges.length });
127+
128+
if (renderMode !== 'sigma' || !containerRef.current) {
129+
setLoading(false);
130+
return;
131+
}
127132

128133
const graph = new Graph();
129134

@@ -169,6 +174,7 @@ export default function Explorer() {
169174
labelSize: 12,
170175
labelWeight: 'bold',
171176
edgeLabelSize: 10,
177+
allowInvalidContainer: true,
172178
nodeReducer: (node, data) => {
173179
const res = { ...data };
174180
if (highlightedNode && highlightedNode !== node) {
@@ -204,7 +210,6 @@ export default function Explorer() {
204210

205211
sigmaRef.current = sigma;
206212
graphRef.current = graph;
207-
setGraphStats({ nodes: data.nodes.length, edges: data.edges.length });
208213
setLoading(false);
209214

210215
requestAnimationFrame(() => {
@@ -223,7 +228,7 @@ export default function Explorer() {
223228
}
224229
graphRef.current = null;
225230
};
226-
}, [selectedRepo, refreshTrigger, getNodeColor, loadNodeDetails]);
231+
}, [selectedRepo, refreshTrigger, renderMode, getNodeColor, loadNodeDetails]);
227232

228233
useEffect(() => {
229234
sigmaRef.current?.refresh();

0 commit comments

Comments
 (0)