From 4cbd70db34b140a026ef1a86a8ef0ba3355a350e Mon Sep 17 00:00:00 2001 From: Cody Leff Date: Wed, 2 Nov 2022 21:58:38 -0600 Subject: [PATCH] fix: Revert shared controls typing change. (#22014) --- .../packages/superset-ui-chart-controls/src/types.ts | 2 +- .../legacy-plugin-chart-histogram/src/controlPanel.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/types.ts b/superset-frontend/packages/superset-ui-chart-controls/src/types.ts index fcb19e702..c2ec31527 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/types.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/src/types.ts @@ -242,7 +242,7 @@ export interface BaseControlConfig< ) => boolean; mapStateToProps?: ( state: ControlPanelState, - controlState?: ControlState, + controlState: ControlState, // TODO: add strict `chartState` typing (see superset-frontend/src/explore/types) chartState?: AnyDict, ) => ExtraControlProps; diff --git a/superset-frontend/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts index d976b16bd..08e315ba4 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts @@ -25,14 +25,15 @@ import { sections, getStandardizedControls, sharedControls, + ControlState, } from '@superset-ui/chart-controls'; const columnsConfig = { ...sharedControls.columns, label: t('Columns'), description: t('Select the numeric columns to draw the histogram'), - mapStateToProps: (state: ControlPanelState) => ({ - ...(sharedControls.columns.mapStateToProps?.(state) || {}), + mapStateToProps: (state: ControlPanelState, controlState: ControlState) => ({ + ...(sharedControls.columns.mapStateToProps?.(state, controlState) || {}), choices: columnChoices(state.datasource), }), validators: [validateNonEmpty],