fix(usage): defensive optional-chaining on breakdown items + sku

This commit is contained in:
michelia
2026-06-03 17:10:51 +08:00
committed by michela feng
parent 820a6cecdd
commit f055453889
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -269,7 +269,7 @@ function flattenItem(
// Per-resource rows (instance / volume) carry their sku → surface it as the
// Instance Type / Type column when not already the group key.
if (!flat.gpu_type && it.sku) {
flat.gpu_type = it.sku;
flat.gpu_type = it.sku ?? undefined;
}
return flat;
}
@@ -182,7 +182,7 @@ const GpuInstancesTab: React.FC = () => {
// along the contiguous date range.
const dataByDate = useMemo(() => {
const map = new Map<string, number>();
chartData?.items.forEach((item) => {
chartData?.items?.forEach((item) => {
if (!item.date) return;
map.set(bucketKey(item.date, granularity), Number(item[metric] ?? 0));
});
+1 -1
View File
@@ -168,7 +168,7 @@ const StorageTab: React.FC = () => {
const dataByDate = useMemo(() => {
const map = new Map<string, number>();
chartData?.items.forEach((item) => {
chartData?.items?.forEach((item) => {
if (!item.date) return;
map.set(bucketKey(item.date, granularity), Number(item[metric] ?? 0));
});