From e80803c50a774e11c5a5411e7ab41bf67f8ecb76 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 13 Jul 2026 19:16:51 +0000 Subject: [PATCH] fix(tags): fall back to row index in DataTable getRowId for idless rows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shared DataTable is also used by the plan table, whose PlanWithTotals rows have no `id` (they carry planId/propertyId). A bare String(row.id) keyed every plan row as "undefined" — colliding React keys. Key by id when present, else by index (restoring the pre-change default for idless consumers). Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app/portfolio/[slug]/components/dataTable.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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(),