graceguo-supercat commented on a change in pull request #9891:
URL: 
https://github.com/apache/incubator-superset/pull/9891#discussion_r430048293



##########
File path: superset-frontend/src/dashboard/components/Dashboard.jsx
##########
@@ -159,11 +159,27 @@ class Dashboard extends React.PureComponent {
           // added filter?
           [].push.apply(affectedChartIds, activeFilters[filterKey].scope);
         } else {
-          // changed filter field value or scope?
-          const affectedScope = (activeFilters[filterKey].scope || []).concat(
-            appliedFilters[filterKey].scope || [],
-          );
-          [].push.apply(affectedChartIds, affectedScope);
+          // has filter field value change?

Review comment:
       added `applyFilters` function.

##########
File path: superset-frontend/src/dashboard/components/Dashboard.jsx
##########
@@ -159,11 +159,27 @@ class Dashboard extends React.PureComponent {
           // added filter?
           [].push.apply(affectedChartIds, activeFilters[filterKey].scope);
         } else {
-          // changed filter field value or scope?
-          const affectedScope = (activeFilters[filterKey].scope || []).concat(
-            appliedFilters[filterKey].scope || [],
-          );
-          [].push.apply(affectedChartIds, affectedScope);
+          // has filter field value change?
+          if (
+            !areObjectsEqual(
+              appliedFilters[filterKey].values,
+              activeFilters[filterKey].values,
+            )
+          ) {
+            [].push.apply(affectedChartIds, activeFilters[filterKey].scope);

Review comment:
       `affectedChartIds.push(...activeFilters[filterKey].scope)` just try to 
merge 2 arrays and assign back to `affectedChartIds`.
   I agree es6 syntax is better. fixed.

##########
File path: superset-frontend/src/dashboard/components/Dashboard.jsx
##########
@@ -159,11 +159,27 @@ class Dashboard extends React.PureComponent {
           // added filter?
           [].push.apply(affectedChartIds, activeFilters[filterKey].scope);
         } else {
-          // changed filter field value or scope?
-          const affectedScope = (activeFilters[filterKey].scope || []).concat(
-            appliedFilters[filterKey].scope || [],
-          );
-          [].push.apply(affectedChartIds, affectedScope);
+          // has filter field value change?
+          if (
+            !areObjectsEqual(
+              appliedFilters[filterKey].values,
+              activeFilters[filterKey].values,
+            )
+          ) {
+            [].push.apply(affectedChartIds, activeFilters[filterKey].scope);

Review comment:
       `[].push.apply(affectedChartIds, activeFilters[filterKey].scope)` just 
try to merge 2 arrays and assign back to `affectedChartIds`.
   I agree es6 syntax is better. fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to