M #-: Protect chartist (#4663)

Signed-off-by: dcarracedo <dcarracedo@opennebula.io>
This commit is contained in:
David authored and GitHub committed 2026-10-29 10:26:24 +01:00
1 parent 44b3d83cbe
commit cbaff76020
1 file changed
+4 -1
@@ -245,7 +245,10 @@ const Chartist = ({
() => {
if (chartRef.current) {
requestAnimationFrame(() => {
const { width, height } = chartRef.current.getBoundingClientRect()
const chart = chartRef.current
if (!chart) return
const { width, height } = chart.getBoundingClientRect()
setChartDimensions({
width: Math.max(width - 16, 50), // Clamping
height: Math.max(height - 32, 50), // Clamping