bugfix: table chart query mode initial value (#10544)

This commit is contained in:
Jesse Yang 2020-08-07 02:25:48 -07:00 committed by GitHub
parent 363abfa1a5
commit ea0db0d195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -165,8 +165,9 @@ describe('Visualization > Table', () => {
metrics: [],
row_limit: 10,
};
cy.visitChartByParams(JSON.stringify(formData));
cy.get('div[data-test="query_mode"] .btn.active').contains('Raw Records');
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'table' });
});

View File

@ -110,7 +110,6 @@ function handleMissingChoice(control) {
export function applyMapStateToPropsToControl(controlState, controlPanelState) {
const { mapStateToProps } = controlState;
let { value } = controlState;
let state = { ...controlState };
if (mapStateToProps && controlPanelState) {
state = {
@ -126,6 +125,7 @@ export function applyMapStateToPropsToControl(controlState, controlPanelState) {
delete state.default;
}
}
let { value } = state;
// If no current value, set it as default
if (state.default && value === undefined) {
value = state.default;