Skip to content
Snippets Groups Projects
Commit 72774acd authored by Tom Robinson's avatar Tom Robinson
Browse files

Pass the last run card to vis to prevent sort from prematurely updating

parent a19ac22d
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,8 @@ export default class QueryVisualization extends Component {
this.runQuery = this.runQuery.bind(this);
this.state = {
origQuery: JSON.stringify(props.card.dataset_query)
lastRunCard: props.card,
lastRunQuery: JSON.stringify(props.card.dataset_query)
};
}
......@@ -52,14 +53,15 @@ export default class QueryVisualization extends Component {
// whenever we are told that we are running a query lets update our understanding of the "current" query
if (nextProps.isRunning) {
this.setState({
origQuery: JSON.stringify(nextProps.card.dataset_query)
lastRunCard: nextProps.card,
lastRunQuery: JSON.stringify(nextProps.card.dataset_query)
});
}
}
queryIsDirty() {
// a query is considered dirty if ANY part of it has been changed
return (JSON.stringify(this.props.card.dataset_query) !== this.state.origQuery);
return (JSON.stringify(this.props.card.dataset_query) !== this.state.lastRunQuery);
}
isChartDisplay(display) {
......@@ -313,7 +315,7 @@ export default class QueryVisualization extends Component {
} else {
viz = (
<Visualization
card={this.props.card}
card={this.state.lastRunCard}
data={this.props.result.data}
// Table:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment