[explorev2] Make chart container more responsive (#1724)

* Make chart container more responsive
 **Leave chart empty when theres error
 **Make all boolean fields auto-query chart when changed

* Replace forEach with some

* Added fields to autoQueryFields
This commit is contained in:
vera-liu
2016-12-01 11:59:44 -08:00
committed by GitHub
parent 1a16491971
commit 2d0ebeae1b
3 changed files with 54 additions and 26 deletions

View File

@@ -33,12 +33,10 @@ class ExploreViewContainer extends React.Component {
}
componentWillReceiveProps(nextProps) {
let refreshChart = false;
autoQueryFields.forEach((field) => {
if (nextProps.form_data[field] !== this.props.form_data[field]) {
refreshChart = true;
}
});
const refreshChart = Object.keys(nextProps.form_data).some((field) => (
nextProps.form_data[field] !== this.props.form_data[field]
&& autoQueryFields.indexOf(field) !== -1)
);
if (refreshChart) {
this.onQuery(nextProps.form_data);
}