mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
fix(charts): bot suggestion applied for cleanup
This commit is contained in:
@@ -59,7 +59,13 @@ export function ChartTool(props: ToolProps) {
|
||||
return
|
||||
}
|
||||
|
||||
rendered = true
|
||||
let chart: Chart | undefined
|
||||
onCleanup(() => {
|
||||
chart?.destroy()
|
||||
rendered = false
|
||||
})
|
||||
|
||||
if (!el.isConnected) return
|
||||
|
||||
const colors = getThemeColors()
|
||||
const isPolar = config.type === "pie" || config.type === "doughnut" || config.type === "polarArea"
|
||||
@@ -81,11 +87,6 @@ export function ChartTool(props: ToolProps) {
|
||||
}
|
||||
})
|
||||
|
||||
let chart: Chart | undefined
|
||||
onCleanup(() => chart?.destroy())
|
||||
|
||||
if (!el.isConnected) return
|
||||
|
||||
try {
|
||||
chart = new Chart(el, {
|
||||
type: config.type as any,
|
||||
@@ -113,6 +114,7 @@ export function ChartTool(props: ToolProps) {
|
||||
...config.options,
|
||||
},
|
||||
})
|
||||
rendered = true
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : "Failed to render chart")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user