This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 19247cc92a Fixes datatable crash when dimension is empty (#20680)
19247cc92a is described below
commit 19247cc92a61bc8101a3c7d196f8801d420e1f13
Author: Usiel Riedl <[email protected]>
AuthorDate: Wed Jul 13 08:54:33 2022 +0200
Fixes datatable crash when dimension is empty (#20680)
Fixes #20679
Co-authored-by: Usiel Riedl <[email protected]>
---
superset-frontend/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 fdc74d7bb4..7cca07a408 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' ? (