From 1a7ef4758b91eb99c086f1bfcc785161c26af35c Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Wed, 31 Jan 2018 09:34:08 -0800 Subject: [PATCH] [Explore] Fix Stop Query Button behavior (#4301) --- 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 3682949bbb387..089a1dd1f7f7b 100644 --- a/superset/assets/javascripts/chart/chartAction.js +++ b/superset/assets/javascripts/chart/chartAction.js @@ -15,10 +15,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 }; } @@ -146,7 +143,9 @@ export function runQuery(formData, force = false, timeout = 60, key) { }); 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 bf9afd4be34b3..9b1ec1629bbf3 100644 --- a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx +++ b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx @@ -97,7 +97,7 @@ class ExploreViewContainer extends React.Component { } onStop() { - this.props.actions.chartUpdateStopped(this.props.chart.queryRequest); + return this.props.chart.queryRequest.abort(); } getWidth() {