Skip to content

Commit

Permalink
fix: controls validator glitch (#20623)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyongjie committed Jul 7, 2022
1 parent d16f274 commit 34e1336
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions superset-frontend/src/explore/controlUtils/standardizedFormData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand All @@ -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) {
Expand All @@ -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;
}
}

0 comments on commit 34e1336

Please sign in to comment.