diff --git a/nextjs-app/app/compare/page.tsx b/nextjs-app/app/compare/page.tsx index 095fe88..4cdf2ff 100644 --- a/nextjs-app/app/compare/page.tsx +++ b/nextjs-app/app/compare/page.tsx @@ -44,8 +44,8 @@ export default async function ComparePage({ searchParams }: ComparePageProps) { // Fetch available metrics const metricsResponse = await fetchMetrics(); - // Convert metrics object to array - const metricsArray = Object.values(metricsResponse?.metrics || {}); + // Metrics is already an array + const metricsArray = metricsResponse?.metrics || []; return ( data?.metrics?.[key], + metrics: data?.metrics || [], + metricsList: data?.metrics || [], + getMetric: (key: string) => data?.metrics?.find(m => m.key === key), isLoading, error, }; diff --git a/nextjs-app/lib/types.ts b/nextjs-app/lib/types.ts index 7a0ded8..7b3d2b6 100644 --- a/nextjs-app/lib/types.ts +++ b/nextjs-app/lib/types.ts @@ -194,8 +194,9 @@ export interface MetricDefinition { hasNationalAverage?: boolean; } +// Backend returns metrics as an array, not an object export interface MetricsResponse { - metrics: Record; + metrics: MetricDefinition[]; } export interface DataInfoResponse {