fix(chart): prevent infinite loops and remove hardcoded text
Some checks failed
CI / Lint, Test & Build (push) Failing after 9s
CI / Deploy production (on server) (push) Has been skipped

- Memoize ChartWrapper to prevent infinite re-renders in MarkdownContent
- Remove hardcoded French text (multilingual app)
- Return null for invalid charts instead of error messages
This commit is contained in:
Antigravity
2026-05-22 18:33:55 +00:00
parent bfaacc557f
commit ca0637cc6e
2 changed files with 11 additions and 5 deletions

View File

@@ -182,7 +182,7 @@ function NoteChart({ type, title, data, colors, showLegend, height = 250 }: Note
}
default:
return <div className="text-center text-muted-foreground py-8">Type de graphique non supporté: {type}</div>
return null
}
}
@@ -246,6 +246,6 @@ export function parseChartFromCode(code: string): NoteChartProps | null {
export function NoteChartFromCode({ code }: { code: string }) {
const props = useMemo(() => parseChartFromCode(code), [code])
if (!props) return <div className="text-center text-muted-foreground py-4">Format de graphique invalide</div>
if (!props) return null
return <NoteChart {...props} />
}