You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by gr...@apache.org on 2017/11/17 20:52:56 UTC

[incubator-superset] branch master updated: Only refreshing non instant filters on apply (#3893)

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

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new a84bd52  Only refreshing non instant filters on apply (#3893)
a84bd52 is described below

commit a84bd5225c040b76a341878234398bedb9fd8592
Author: michellethomas <mi...@gmail.com>
AuthorDate: Fri Nov 17 12:52:48 2017 -0800

    Only refreshing non instant filters on apply (#3893)
---
 superset/assets/javascripts/dashboard/reducers.js |  4 ++--
 superset/assets/visualizations/filter_box.jsx     | 13 +++++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/superset/assets/javascripts/dashboard/reducers.js b/superset/assets/javascripts/dashboard/reducers.js
index 8d7b7f4..5001fd1 100644
--- a/superset/assets/javascripts/dashboard/reducers.js
+++ b/superset/assets/javascripts/dashboard/reducers.js
@@ -134,9 +134,9 @@ const dashboard = function (state = {}, action) {
           // d3.merge pass in array of arrays while some value form filter components
           // from and to filter box require string to be process and return
         } else if (state.filters[sliceId][col] instanceof Array) {
-          newFilter = d3.merge([state.filters[sliceId][col], vals]);
+          newFilter[col] = d3.merge([state.filters[sliceId][col], vals]);
         } else {
-          newFilter = d3.merge([[state.filters[sliceId][col]], vals])[0] || '';
+          newFilter[col] = d3.merge([[state.filters[sliceId][col]], vals])[0] || '';
         }
         filters = { ...state.filters, [sliceId]: newFilter };
       }
diff --git a/superset/assets/visualizations/filter_box.jsx b/superset/assets/visualizations/filter_box.jsx
index bdcf978..7653ec2 100644
--- a/superset/assets/visualizations/filter_box.jsx
+++ b/superset/assets/visualizations/filter_box.jsx
@@ -72,7 +72,14 @@ class FilterBox extends React.Component {
     return control;
   }
   clickApply() {
-    this.props.onChange(Object.keys(this.state.selectedValues)[0], [], true, true);
+    const { selectedValues } = this.state;
+    Object.keys(selectedValues).forEach((fltr, i, arr) => {
+      let refresh = false;
+      if (i === arr.length - 1) {
+        refresh = true;
+      }
+      this.props.onChange(fltr, selectedValues[fltr], false, refresh);
+    });
     this.setState({ hasChanged: false });
   }
   changeFilter(filter, options) {
@@ -90,7 +97,9 @@ class FilterBox extends React.Component {
     const selectedValues = Object.assign({}, this.state.selectedValues);
     selectedValues[fltr] = vals;
     this.setState({ selectedValues, hasChanged: true });
-    this.props.onChange(fltr, vals, false, this.props.instantFiltering);
+    if (this.props.instantFiltering) {
+      this.props.onChange(fltr, vals, false, true);
+    }
   }
   render() {
     let dateFilter;

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <co...@superset.apache.org>'].