Skip to content

Commit a8b46b2

Browse files
committed
fix(dependency-graph): limit zoom out for large graphs, remove debug logs
1 parent a07dfa7 commit a8b46b2

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

frontend/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Frontend Dockerfile - Multi-stage build
2-
FROM node:20-alpine AS builder
1+
# Frontend Dockerfile - Multi-stage build with Bun
2+
FROM oven/bun:1 AS builder
33

44
WORKDIR /app
55

@@ -14,16 +14,16 @@ ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL
1414
ENV VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY
1515

1616
# Copy package files
17-
COPY package*.json ./
17+
COPY package.json bun.lock* ./
1818

1919
# Install dependencies
20-
RUN npm ci
20+
RUN bun install --frozen-lockfile || bun install
2121

2222
# Copy source code
2323
COPY . .
2424

2525
# Build for production
26-
RUN npm run build
26+
RUN bun run build
2727

2828
# Production image - nginx
2929
FROM nginx:alpine

frontend/src/components/DependencyGraph/index.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)