You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/05/27 04:07:35 UTC

[GitHub] [incubator-superset] graceguo-supercat commented on a change in pull request #9891: fix: [dashboard] should not trigger chart refresh when filter not applicable

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org