fix(chart): prevent infinite loops and remove hardcoded text
- 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:
@@ -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} />
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user