@@ -112,7 +112,7 @@ function DependencyGraphInner({ repoId, apiUrl, apiKey }: DependencyGraphProps)
112112 const visibleNodeIds = useMemo ( ( ) => {
113113 if ( ! rawGraphData || ! impact . isReady ) return new Set < string > ( )
114114
115- let nodeIds = rawGraphData . nodes . map ( ( n : any ) => n . id )
115+ let nodeIds : string [ ] = rawGraphData . nodes . map ( ( n : any ) => n . id )
116116
117117 // Filter out tests if disabled
118118 if ( ! showTests ) {
@@ -129,7 +129,7 @@ function DependencyGraphInner({ repoId, apiUrl, apiKey }: DependencyGraphProps)
129129 }
130130
131131 return new Set ( nodeIds )
132- } , [ rawGraphData , impact , showAll , showTests ] )
132+ } , [ rawGraphData , impact . isReady , impact . fileMetrics , showAll , showTests ] )
133133
134134 // Get impact result for selected node
135135 const selectedImpact = useMemo ( ( ) : ImpactResult | null => {
@@ -210,12 +210,14 @@ function DependencyGraphInner({ repoId, apiUrl, apiKey }: DependencyGraphProps)
210210 const { nodes : layoutedNodes , edges : layoutedEdges } = getLayoutedElements ( flowNodes , flowEdges )
211211 setNodes ( layoutedNodes )
212212 setEdges ( layoutedEdges )
213- } , [ rawGraphData , impact , visibleNodeIds , selectedNodeId , selectedImpact , hoveredFileId ] )
213+ } , [ rawGraphData , impact . isReady , visibleNodeIds , selectedNodeId , selectedImpact , hoveredFileId ] )
214214
215215 // Fit view when nodes change significantly
216216 useEffect ( ( ) => {
217217 if ( nodes . length > 0 ) {
218- setTimeout ( ( ) => fitView ( { padding : 0.2 , duration : 300 } ) , 100 )
218+ // Don't zoom out too much for large graphs
219+ const minZoom = nodes . length > 20 ? 0.5 : 0.3
220+ setTimeout ( ( ) => fitView ( { padding : 0.2 , duration : 300 , minZoom } ) , 100 )
219221 }
220222 } , [ showAll , showTests ] )
221223
@@ -239,8 +241,9 @@ function DependencyGraphInner({ repoId, apiUrl, apiKey }: DependencyGraphProps)
239241
240242 const handleResetView = useCallback ( ( ) => {
241243 setSelectedNodeId ( null )
242- fitView ( { padding : 0.2 , duration : 300 } )
243- } , [ fitView ] )
244+ const minZoom = nodes . length > 20 ? 0.5 : 0.3
245+ fitView ( { padding : 0.2 , duration : 300 , minZoom } )
246+ } , [ fitView , nodes . length ] )
244247
245248 if ( isLoading ) {
246249 return < DependencyGraphSkeleton />
@@ -286,9 +289,9 @@ function DependencyGraphInner({ repoId, apiUrl, apiKey }: DependencyGraphProps)
286289 />
287290
288291 { /* Graph + Panel */ }
289- < div className = "flex-1 flex overflow-hidden min-h-[500px]" >
292+ < div className = "flex overflow-hidden" style = { { height : '600px' } } >
290293 { /* Graph Canvas */ }
291- < div className = " flex-1 relative h-full" >
294+ < div style = { { flex : 1 , height : '600px' } } >
292295 < ReactFlow
293296 nodes = { nodes }
294297 edges = { edges }
0 commit comments