diff --git a/apps/console/src/app/(console)/dashboard/page.tsx b/apps/console/src/app/(console)/dashboard/page.tsx index 174e3f92..daeafed5 100644 --- a/apps/console/src/app/(console)/dashboard/page.tsx +++ b/apps/console/src/app/(console)/dashboard/page.tsx @@ -10,7 +10,8 @@ function TrendChart({ values, labels }: { values: number[]; labels?: string[] }) return
; } - const max = Math.max(...values, 1); + // ⚡ Bolt: Avoid spread operator overhead which can cause call stack issues with large arrays. + const max = values.reduce((m, v) => (v > m ? v : m), 1); const linePoints = values .map((value, index) => { const x = (index / Math.max(values.length - 1, 1)) * 100; @@ -44,7 +45,8 @@ function TrendChart({ values, labels }: { values: number[]; labels?: string[] }) } function MeterList({ items }: { items: Array<{ label: string; value: number; hint?: string }> }) { - const max = Math.max(...items.map((i) => i.value), 1); + // ⚡ Bolt: Avoid O(N) intermediate array allocation and spread operator overhead by using a single reduce pass. + const max = items.reduce((currentMax, item) => (item.value > currentMax ? item.value : currentMax), 1); return (AI Gateway is provided "as is" without warranties of any kind. We are not liable for indirect, incidental, or consequential damages arising from service use.
+AI Gateway is provided "as is" without warranties of any kind. We are not liable for indirect, incidental, or consequential damages arising from service use.