From 19247cc92a61bc8101a3c7d196f8801d420e1f13 Mon Sep 17 00:00:00 2001 From: Usiel Riedl Date: Wed, 13 Jul 2022 08:54:33 +0200 Subject: [PATCH] Fixes datatable crash when dimension is empty (#20680) Fixes #20679 Co-authored-by: Usiel Riedl --- .../src/explore/components/DataTableControl/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/explore/components/DataTableControl/index.tsx b/superset-frontend/src/explore/components/DataTableControl/index.tsx index fdc74d7bb4cde..7cca07a408008 100644 --- a/superset-frontend/src/explore/components/DataTableControl/index.tsx +++ b/superset-frontend/src/explore/components/DataTableControl/index.tsx @@ -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' ? (