mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: Visualization settings were lost when editing a datasource from Explore (#10092)
This commit is contained in:
@@ -28,6 +28,7 @@ describe('reducers', () => {
|
||||
actions.setControlValue('x_axis_label', 'x', []),
|
||||
);
|
||||
expect(newState.controls.x_axis_label.value).toBe('x');
|
||||
expect(newState.form_data.x_axis_label).toBe('x');
|
||||
});
|
||||
it('setControlValue works as expected with a checkbox', () => {
|
||||
const newState = exploreReducer(
|
||||
@@ -35,5 +36,6 @@ describe('reducers', () => {
|
||||
actions.setControlValue('show_legend', true, []),
|
||||
);
|
||||
expect(newState.controls.show_legend.value).toBe(true);
|
||||
expect(newState.form_data.show_legend).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -94,12 +94,8 @@ export default function exploreReducer(state = {}, action) {
|
||||
};
|
||||
},
|
||||
[actions.SET_FIELD_VALUE]() {
|
||||
let new_form_data = state.form_data;
|
||||
if (action.controlName === 'viz_type') {
|
||||
new_form_data = JSON.parse(JSON.stringify(new_form_data));
|
||||
// Update state's vizType if we are switching to a new visualization
|
||||
new_form_data.viz_type = action.value;
|
||||
}
|
||||
const new_form_data = state.form_data;
|
||||
new_form_data[action.controlName] = action.value;
|
||||
|
||||
// These errors are reported from the Control components
|
||||
let errors = action.validationErrors || [];
|
||||
|
||||
Reference in New Issue
Block a user