From 1a8c28db3dd8eef386db82b1f502fd049e6f82f2 Mon Sep 17 00:00:00 2001 From: Eric Briscoe Date: Fri, 29 Jul 2022 15:14:03 -0700 Subject: [PATCH] Fixes issue where type query datasource had incorrect time controls when datasource type was 'query' (#20923) --- .../src/explore/controlUtils/getSectionsToRender.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/superset-frontend/src/explore/controlUtils/getSectionsToRender.ts b/superset-frontend/src/explore/controlUtils/getSectionsToRender.ts index e53d7b921d..5bfefb8ec6 100644 --- a/superset-frontend/src/explore/controlUtils/getSectionsToRender.ts +++ b/superset-frontend/src/explore/controlUtils/getSectionsToRender.ts @@ -54,11 +54,11 @@ const getMemoizedSectionsToRender = memoizeOne( const { datasourceAndVizType } = sections; - // list of datasource-specific controls that should be removed - const invalidControls = - datasourceType === 'table' - ? ['granularity'] - : ['granularity_sqla', 'time_grain_sqla']; + // list of datasource-specific controls that should be removed if the datasource is a specific type + const filterControlsForTypes = [DatasourceType.Query, DatasourceType.Table]; + const invalidControls = filterControlsForTypes.includes(datasourceType) + ? ['granularity'] + : ['granularity_sqla', 'time_grain_sqla']; return [datasourceAndVizType] .concat(controlPanelSections.filter(isControlPanelSectionConfig))