From a6d6674e6758d50dc585d2cc4811e00f46357cae Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Wed, 6 Jul 2022 20:10:57 +0800 Subject: [PATCH] fix: controls validator glitch --- .../controlUtils/standardizedFormData.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/superset-frontend/src/explore/controlUtils/standardizedFormData.ts b/superset-frontend/src/explore/controlUtils/standardizedFormData.ts index 36188cde88a27..399f79416b185 100644 --- a/superset-frontend/src/explore/controlUtils/standardizedFormData.ts +++ b/superset-frontend/src/explore/controlUtils/standardizedFormData.ts @@ -187,6 +187,7 @@ export class StandardizedFormData { * 4. attach `standardizedFormData` to the initial form_data * 5. call formDataOverrides to transform initial form_data if the plugin was defined * 6. use final form_data to generate controlsState + * 7. to refresh validator message * */ const latestFormData = this.getLatestFormData(targetVizType); const publicFormData = {}; @@ -204,6 +205,10 @@ export class StandardizedFormData { ...getFormDataFromControls(targetControlsState), standardizedFormData: this.serialize(), }; + let rv = { + formData: targetFormData, + controlsState: targetControlsState, + }; const controlPanel = getChartControlPanelRegistry().get(targetVizType); if (controlPanel?.formDataOverrides) { @@ -216,16 +221,17 @@ export class StandardizedFormData { }, }; getStandardizedControls().clear(); - - return { + rv = { formData: transformed, controlsState: getControlsState(exploreState, transformed), }; } - return { - formData: targetFormData, - controlsState: targetControlsState, - }; + // refresh validator message + rv.controlsState = getControlsState( + { ...exploreState, controls: rv.controlsState }, + rv.formData, + ); + return rv; } }