Skip to content

Commit

Permalink
Fixes datatable crash when dimension is empty (apache#20680)
Browse files Browse the repository at this point in the history
Fixes apache#20679

Co-authored-by: Usiel Riedl <usiel.riedl@automattic.com>
  • Loading branch information
Usiel and Usiel authored Jul 13, 2022
1 parent b1020e3 commit 19247cc
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ export const useTableColumns = (
const isOriginalTimeColumn =
originalFormattedTimeColumns.includes(key);
return {
id: key,
// react-table requires a non-empty id, therefore we introduce a fallback value in case the key is empty
id: key || index,
accessor: row => row[key],
// When the key is empty, have to give a string of length greater than 0
Header:
colType === GenericDataType.TEMPORAL &&
typeof firstValue !== 'string' ? (
Expand Down

0 comments on commit 19247cc

Please sign in to comment.