Skip to content

Commit 55bc0a3

Browse files
committed
refactor: address feedback on CostTrendChart
1 parent f13a49d commit 55bc0a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

webview-ui/src/components/chat/CostTrendChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const CostTrendChart: React.FC<CostTrendChartProps> = ({ data, onHoverChange })
7070
const costDeltas = data.map((d) => d.costDelta)
7171

7272
// Cast to any to bypass TypeScript error - uPlot actually accepts regular arrays
73-
return [requestIndices, costDeltas] as any
73+
return [requestIndices, costDeltas] as [number[], number[]]
7474
}, [data])
7575

7676
// 2. Define uPlot Options using resolved styles
@@ -194,7 +194,6 @@ const CostTrendChart: React.FC<CostTrendChartProps> = ({ data, onHoverChange })
194194

195195
// Ensure data is valid before calling callback
196196
if (typeof requestIndex === "number" && typeof costDelta === "number") {
197-
console.log(`[CostTrendChart Hover] Index: ${requestIndex}, CostDelta: ${costDelta}`) // <-- Add logging
198197
onHoverChange({ isHovering: true, index: requestIndex, cost: costDelta })
199198
} else {
200199
// Data point invalid, treat as not hovering
@@ -231,7 +230,8 @@ const CostTrendChart: React.FC<CostTrendChartProps> = ({ data, onHoverChange })
231230

232231
try {
233232
// Create new uPlot instance
234-
const uplotInstance = new uPlot(options, uplotData, chartRef.current)
233+
// Cast uplotData here where we know it's not empty, acknowledging uPlot's runtime flexibility
234+
const uplotInstance = new uPlot(options, uplotData as uPlot.AlignedData, chartRef.current)
235235
uplotInstanceRef.current = uplotInstance
236236
// console.log("uPlot instance created successfully");
237237
} catch (error) {

0 commit comments

Comments
 (0)