diff --git a/src/app/portfolio/[slug]/components/dataTable.tsx b/src/app/portfolio/[slug]/components/dataTable.tsx index 75e654ef..6e278cd8 100644 --- a/src/app/portfolio/[slug]/components/dataTable.tsx +++ b/src/app/portfolio/[slug]/components/dataTable.tsx @@ -82,9 +82,11 @@ export default function DataTable>({ data, columns, - // Map selection/row identity to the property's stable id, so a selection - // survives pagination and lazy-loaded pages (not row-index keyed). - getRowId: (row) => String(row.id), + // Key rows by their stable id when present (so a selection survives + // pagination + lazy-loaded pages), falling back to the row index for + // consumers whose rows have no `id` (e.g. the plan table) — otherwise every + // idless row would collide on the key "undefined". + getRowId: (row, index) => (row.id != null ? String(row.id) : String(index)), getCoreRowModel: getCoreRowModel(), getSortedRowModel: getSortedRowModel(),