You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2023/11/20 19:29:22 UTC

(superset) 01/04: fix(explore): redandant force param (#25985)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit e3fbb01bb8c5511628401f4f739ba7ead156b4bc
Author: JUST.in DO IT <ju...@airbnb.com>
AuthorDate: Thu Nov 16 12:58:06 2023 -0800

    fix(explore): redandant force param (#25985)
    
    (cherry picked from commit e7a187680713867f22b082f3bb0a57296d2a331c)
---
 superset-frontend/src/components/Chart/Chart.jsx            | 2 +-
 superset-frontend/src/components/Chart/chartAction.js       | 2 +-
 superset-frontend/src/components/Chart/chartActions.test.js | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/src/components/Chart/Chart.jsx b/superset-frontend/src/components/Chart/Chart.jsx
index af90ae6b0a..da9a81516f 100644
--- a/superset-frontend/src/components/Chart/Chart.jsx
+++ b/superset-frontend/src/components/Chart/Chart.jsx
@@ -169,7 +169,7 @@ class Chart extends React.PureComponent {
       // Create chart with POST request
       this.props.actions.postChartFormData(
         this.props.formData,
-        this.props.force || getUrlParam(URL_PARAMS.force), // allow override via url params force=true
+        Boolean(this.props.force || getUrlParam(URL_PARAMS.force)), // allow override via url params force=true
         this.props.timeout,
         this.props.chartId,
         this.props.dashboardId,
diff --git a/superset-frontend/src/components/Chart/chartAction.js b/superset-frontend/src/components/Chart/chartAction.js
index d08070fe40..6db969ebb9 100644
--- a/superset-frontend/src/components/Chart/chartAction.js
+++ b/superset-frontend/src/components/Chart/chartAction.js
@@ -185,7 +185,7 @@ const v1ChartDataRequest = async (
   const qs = {};
   if (sliceId !== undefined) qs.form_data = `{"slice_id":${sliceId}}`;
   if (dashboardId !== undefined) qs.dashboard_id = dashboardId;
-  if (force !== false) qs.force = force;
+  if (force) qs.force = force;
 
   const allowDomainSharding =
     // eslint-disable-next-line camelcase
diff --git a/superset-frontend/src/components/Chart/chartActions.test.js b/superset-frontend/src/components/Chart/chartActions.test.js
index 65b008de62..b44ca7c8d7 100644
--- a/superset-frontend/src/components/Chart/chartActions.test.js
+++ b/superset-frontend/src/components/Chart/chartActions.test.js
@@ -51,7 +51,7 @@ describe('chart actions', () => {
       .callsFake(() => MOCK_URL);
     getChartDataUriStub = sinon
       .stub(exploreUtils, 'getChartDataUri')
-      .callsFake(() => URI(MOCK_URL));
+      .callsFake(({ qs }) => URI(MOCK_URL).query(qs));
     fakeMetadata = { useLegacyApi: true };
     metadataRegistryStub = sinon
       .stub(chartlib, 'getChartMetadataRegistry')
@@ -81,7 +81,7 @@ describe('chart actions', () => {
     });
 
     it('should query with the built query', async () => {
-      const actionThunk = actions.postChartFormData({});
+      const actionThunk = actions.postChartFormData({}, null);
       await actionThunk(dispatch);
 
       expect(fetchMock.calls(MOCK_URL)).toHaveLength(1);