Skip to content

Commit 3b3e8a9

Browse files
authored
DOP-5273: add console warning for column out of index and continue (#1339)
1 parent 2a63645 commit 3b3e8a9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/ListTable.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,12 @@ const generateRowsData = (bodyRowNodes, columns) => {
213213
const rowNodes = bodyRowNodes.map((node) => node?.children[0]?.children ?? []);
214214
const rows = rowNodes.map((rowNode) => {
215215
return rowNode.reduce((res, columnNode, colIndex) => {
216-
res[columns[colIndex].accessorKey] = (
216+
const column = columns[colIndex];
217+
if (!column) {
218+
console.warn(`Row has too many items (index ${colIndex}) for table with ${columns.length} columns`);
219+
return res;
220+
}
221+
res[column?.accessorKey ?? colIndex] = (
217222
<>
218223
{columnNode.children.map((cellNode, index) => (
219224
<ComponentFactory key={index} nodeData={cellNode} />

0 commit comments

Comments
 (0)