[fix] JS error out when rename a new chart (#6752)

This commit is contained in:
Grace Guo 2019-01-24 21:31:21 -08:00 committed by GitHub
parent 97cb10dbc8
commit 879c553b0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -176,10 +176,12 @@ AnnotationLayerControl.defaultProps = defaultProps;
// directly, could not figure out how to get access to the color_scheme
function mapStateToProps({ charts, explore }) {
const chartKey = getChartKey(explore);
const chart = charts[chartKey] || charts[0] || {};
return {
colorScheme: (explore.controls || {}).color_scheme.value,
annotationError: charts[chartKey].annotationError,
annotationQuery: charts[chartKey].annotationQuery,
annotationError: chart.annotationError,
annotationQuery: chart.annotationQuery,
vizType: explore.controls.viz_type.value,
};
}