Skip to content

Commit

Permalink
Optimizing the standalone view (#2663)
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 authored Apr 24, 2017
1 parent eb762c8 commit cdfc4a3
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 cdfc4a3

Please sign in to comment.