This is an automated email from the ASF dual-hosted git repository.
johnbodley 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 a6abcd9ea8 fix: Address regression in main_dttm_col for non-dnd
(#20712)
a6abcd9ea8 is described below
commit a6abcd9ea8fac4a477b824adb367b4b5206a5d27
Author: John Bodley <[email protected]>
AuthorDate: Thu Jul 14 23:51:03 2022 -0700
fix: Address regression in main_dttm_col for non-dnd (#20712)
Co-authored-by: John Bodley <[email protected]>
---
.../packages/superset-ui-chart-controls/src/shared-controls/index.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx
b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx
index b67b4a5d2a..1d99fa77ea 100644
---
a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx
+++
b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx
@@ -289,14 +289,14 @@ const granularity_sqla:
SharedControlConfig<'SelectControl', ColumnMeta> = {
mapStateToProps: state => {
const props: Partial<SelectControlConfig<ColumnMeta | QueryColumn>> = {};
const { datasource } = state;
- if (datasource?.columns[0]?.hasOwnProperty('main_dttm_col')) {
+ if (datasource?.hasOwnProperty('main_dttm_col')) {
const dataset = datasource as Dataset;
props.options = dataset.columns.filter((c: ColumnMeta) => c.is_dttm);
props.default = null;
if (dataset.main_dttm_col) {
props.default = dataset.main_dttm_col;
} else if (props?.options) {
- props.default = (props.options[0] as ColumnMeta).column_name;
+ props.default = (props.options[0] as ColumnMeta)?.column_name;
}
} else {
const sortedQueryColumns = (datasource as QueryResponse)?.columns?.sort(