From c3308b35c1fbd07bb17efbb3e5e95304d6814f92 Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Fri, 26 Jan 2018 15:26:55 -0800 Subject: [PATCH] [Explore] Fix Stop Query Button behavior --- superset/assets/javascripts/chart/chartAction.js | 9 ++++----- .../explore/components/ExploreViewContainer.jsx | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/superset/assets/javascripts/chart/chartAction.js b/superset/assets/javascripts/chart/chartAction.js index 393400d6bcd6f..0cb2eabe76858 100644 --- a/superset/assets/javascripts/chart/chartAction.js +++ b/superset/assets/javascripts/chart/chartAction.js @@ -14,10 +14,7 @@ export function chartUpdateSucceeded(queryResponse, key) { } export const CHART_UPDATE_STOPPED = 'CHART_UPDATE_STOPPED'; -export function chartUpdateStopped(queryRequest, key) { - if (queryRequest) { - queryRequest.abort(); - } +export function chartUpdateStopped(key) { return { type: CHART_UPDATE_STOPPED, key }; } @@ -119,7 +116,9 @@ export function runQuery(formData, force = false, timeout = 60, key) { .catch((err) => { if (err.statusText === 'timeout') { dispatch(chartUpdateTimeout(err.statusText, timeout, key)); - } else if (err.statusText !== 'abort') { + } else if (err.statusText === 'abort') { + dispatch(chartUpdateStopped(key)); + } else { let errObject; if (err.responseJSON) { errObject = err.responseJSON; diff --git a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx index 835cc1a3beef4..6da98b0b008bd 100644 --- a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx +++ b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx @@ -79,7 +79,7 @@ class ExploreViewContainer extends React.Component { } onStop() { - this.props.actions.chartUpdateStopped(this.props.chart.queryRequest); + return this.props.chart.queryRequest.abort(); } getWidth() {