Skip to content

Commit

Permalink
Optimizing the standalone view
Browse files Browse the repository at this point in the history
The standalone view doesn't need to fetch the datasources asynchronously
to fill in the dataources dropdown, it also doesn't need to render any
of the controls.
  • Loading branch information
mistercrunch committed Apr 22, 2017
1 parent 54137ad commit 235cb4c
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ class ExploreViewContainer extends React.Component {
}

componentDidMount() {
this.props.actions.fetchDatasources();
if (!this.props.standalone) {
this.props.actions.fetchDatasources();
}
window.addEventListener('resize', this.handleResize.bind(this));
this.triggerQueryIfNeeded();
}

componentWillReceiveProps(np) {
Expand All @@ -47,9 +50,7 @@ class ExploreViewContainer extends React.Component {
}

componentDidUpdate() {
if (this.props.triggerQuery && !this.hasErrors()) {
this.runQuery();
}
this.triggerQueryIfNeeded();
}

componentWillUnmount() {
Expand All @@ -61,7 +62,8 @@ class ExploreViewContainer extends React.Component {
this.props.actions.removeControlPanelAlert();
this.props.actions.removeChartAlert();

this.runQuery();
this.props.actions.triggerQuery();

history.pushState(
{},
document.title,
Expand All @@ -81,8 +83,10 @@ class ExploreViewContainer extends React.Component {
}


runQuery() {
this.props.actions.runQuery(this.props.form_data);
triggerQueryIfNeeded() {
if (this.props.triggerQuery && !this.hasErrors()) {
this.props.actions.runQuery(this.props.form_data);
}
}

handleResize() {
Expand Down

0 comments on commit 235cb4c

Please sign in to comment.