fix(usage): defensive optional-chaining on breakdown items + sku
This commit is contained in:
@@ -269,7 +269,7 @@ function flattenItem(
|
|||||||
// Per-resource rows (instance / volume) carry their sku → surface it as the
|
// Per-resource rows (instance / volume) carry their sku → surface it as the
|
||||||
// Instance Type / Type column when not already the group key.
|
// Instance Type / Type column when not already the group key.
|
||||||
if (!flat.gpu_type && it.sku) {
|
if (!flat.gpu_type && it.sku) {
|
||||||
flat.gpu_type = it.sku;
|
flat.gpu_type = it.sku ?? undefined;
|
||||||
}
|
}
|
||||||
return flat;
|
return flat;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ const GpuInstancesTab: React.FC = () => {
|
|||||||
// along the contiguous date range.
|
// along the contiguous date range.
|
||||||
const dataByDate = useMemo(() => {
|
const dataByDate = useMemo(() => {
|
||||||
const map = new Map<string, number>();
|
const map = new Map<string, number>();
|
||||||
chartData?.items.forEach((item) => {
|
chartData?.items?.forEach((item) => {
|
||||||
if (!item.date) return;
|
if (!item.date) return;
|
||||||
map.set(bucketKey(item.date, granularity), Number(item[metric] ?? 0));
|
map.set(bucketKey(item.date, granularity), Number(item[metric] ?? 0));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ const StorageTab: React.FC = () => {
|
|||||||
|
|
||||||
const dataByDate = useMemo(() => {
|
const dataByDate = useMemo(() => {
|
||||||
const map = new Map<string, number>();
|
const map = new Map<string, number>();
|
||||||
chartData?.items.forEach((item) => {
|
chartData?.items?.forEach((item) => {
|
||||||
if (!item.date) return;
|
if (!item.date) return;
|
||||||
map.set(bucketKey(item.date, granularity), Number(item[metric] ?? 0));
|
map.set(bucketKey(item.date, granularity), Number(item[metric] ?? 0));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user