From 7fee5d638687cbfdedf299bde2bd0e6685846834 Mon Sep 17 00:00:00 2001 From: Michael Orenstein Date: Tue, 3 Dec 2024 22:38:57 +1030 Subject: [PATCH] fix: crash when ungrouping after aggregation row was pinned --- packages/table-core/src/features/RowPinning.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/table-core/src/features/RowPinning.ts b/packages/table-core/src/features/RowPinning.ts index 02288ab8d1..a3a78f7b29 100644 --- a/packages/table-core/src/features/RowPinning.ts +++ b/packages/table-core/src/features/RowPinning.ts @@ -236,8 +236,15 @@ export const RowPinning: TableFeature = { ? //get all rows that are pinned even if they would not be otherwise visible //account for expanded parent rows, but not pagination or filtering (pinnedRowIds ?? []).map(rowId => { - const row = table.getRow(rowId, true) - return row.getIsAllParentsExpanded() ? row : null + try { + const row = table.getRow(rowId, true) + return row.getIsAllParentsExpanded() ? row : null + } catch (err) { + // This catch block catches if getRow throws, which it will do if the + // row isn't found. It was likely an aggregation row which has since + // disappeared, so consume the error and return. + return null + } }) : //else get only visible rows that are pinned (pinnedRowIds ?? []).map(