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

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


The following commit(s) were added to refs/heads/master by this push:
     new 90e2d82a38 fix(dashboard): Incorrect scopes of cross filters (#20927)
90e2d82a38 is described below

commit 90e2d82a38508938c7dcc92bad0087b529489fce
Author: Kamil Gabryjelski <[email protected]>
AuthorDate: Mon Aug 1 13:39:42 2022 +0200

    fix(dashboard): Incorrect scopes of cross filters (#20927)
---
 superset-frontend/src/dashboard/actions/hydrate.js | 31 +++++++++++++---------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/superset-frontend/src/dashboard/actions/hydrate.js 
b/superset-frontend/src/dashboard/actions/hydrate.js
index 94001767fa..221d8507d4 100644
--- a/superset-frontend/src/dashboard/actions/hydrate.js
+++ b/superset-frontend/src/dashboard/actions/hydrate.js
@@ -337,6 +337,25 @@ export const hydrateDashboard =
         if (!metadata.chart_configuration) {
           metadata.chart_configuration = {};
         }
+        if (behaviors.includes(Behavior.INTERACTIVE_CHART)) {
+          if (!metadata.chart_configuration[chartId]) {
+            metadata.chart_configuration[chartId] = {
+              id: chartId,
+              crossFilters: {
+                scope: {
+                  rootPath: [DASHBOARD_ROOT_ID],
+                  excluded: [chartId], // By default it doesn't affects itself
+                },
+              },
+            };
+          }
+          metadata.chart_configuration[chartId].crossFilters.chartsInScope =
+            getChartIdsInFilterScope(
+              metadata.chart_configuration[chartId].crossFilters.scope,
+              chartQueries,
+              dashboardLayout.present,
+            );
+        }
         if (
           behaviors.includes(Behavior.INTERACTIVE_CHART) &&
           !metadata.chart_configuration[chartId]
@@ -348,21 +367,9 @@ export const hydrateDashboard =
                 rootPath: [DASHBOARD_ROOT_ID],
                 excluded: [chartId], // By default it doesn't affects itself
               },
-              chartsInScope: Array.from(sliceIds),
             },
           };
         }
-        if (
-          behaviors.includes(Behavior.INTERACTIVE_CHART) &&
-          !metadata.chart_configuration[chartId].crossFilters?.chartsInScope
-        ) {
-          metadata.chart_configuration[chartId].crossFilters.chartsInScope =
-            getChartIdsInFilterScope(
-              metadata.chart_configuration[chartId].crossFilters.scope,
-              charts,
-              dashboardLayout.present,
-            );
-        }
       });
     }
 

Reply via email to