From d8d51df40efa0bbe49ad62209586d57f6dd6f02d Mon Sep 17 00:00:00 2001 From: DenizUgur Date: Tue, 24 Sep 2024 10:09:08 -0700 Subject: [PATCH] fix specification ids --- src/components/DataDisplay/Table.tsx | 5 +++-- src/utils/data.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/DataDisplay/Table.tsx b/src/components/DataDisplay/Table.tsx index 6c8a22f..24a44d5 100644 --- a/src/components/DataDisplay/Table.tsx +++ b/src/components/DataDisplay/Table.tsx @@ -63,8 +63,9 @@ export default function Table({ data, globalFilter }: { data: object[]; globalFi const keys = new Set(); data.forEach((row) => Object.keys(row).forEach((key) => keys.add(key))); - // Remove isMPEG from keys + // Remove meta columns if (keys.has("isMPEG")) keys.delete("isMPEG"); + if (keys.has("id")) keys.delete("id"); // Generate columns return Array.from(keys).map((header) => { @@ -128,7 +129,7 @@ export default function Table({ data, globalFilter }: { data: object[]; globalFi getCoreRowModel: getCoreRowModel(), getFilteredRowModel: getFilteredRowModel(), getSortedRowModel: getSortedRowModel(), - getRowId: (row, index) => (pathname === "/references" && row.specification) || index + getRowId: (row, index) => (pathname === "/references" && row.id) || index }); if (globalFilter !== undefined && globalFilter.length < 2) return null; diff --git a/src/utils/data.ts b/src/utils/data.ts index 812d9de..afa1089 100644 --- a/src/utils/data.ts +++ b/src/utils/data.ts @@ -26,6 +26,7 @@ export default async function getData(filename: string): Promise { if (filename === "specifications") { // Transform each entry in the array records = specifications.map((record) => ({ + id: record.specification, specification: `${record.specification}`, description: record.description }));