Skip to content

Commit 6008598

Browse files
authored
fix(AnalyticalTable): add error log for nested headers (#8300)
Closes #8293
1 parent 952c60b commit 6008598

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

packages/main/src/components/AnalyticalTable/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,14 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
346346
setGlobalFilter,
347347
} = tableInstanceRef.current;
348348

349+
useEffect(() => {
350+
if (process.env.NODE_ENV === 'development' && headerGroups.length > 1) {
351+
console.error(
352+
'[AnalyticalTable] Nested column headers are not supported. Please flatten your column definitions.',
353+
);
354+
}
355+
}, [headerGroups.length]);
356+
349357
const tableState: AnalyticalTableState = tableInstanceRef.current.state;
350358
const { popInColumns, triggerScroll } = tableState;
351359
const isGrouped = !!tableState.groupBy.length;

packages/main/src/components/AnalyticalTable/types/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ export interface TableInstance {
166166
groupedFlatRows?: RowType[];
167167
groupedRows?: RowType[];
168168
groupedRowsById?: Record<string, RowType>;
169+
/**
170+
* Nested column headers are not supported. This array must only contain a single header group.
171+
*/
169172
headerGroups: Record<string, any>[];
170173
headers: ColumnType[];
171174
initialRows: RowType[];

0 commit comments

Comments
 (0)