kgabryje commented on a change in pull request #19064:
URL: https://github.com/apache/superset/pull/19064#discussion_r822512447



##########
File path: superset-frontend/src/dashboard/util/activeDashboardFilters.js
##########
@@ -61,8 +60,26 @@ export function getAppliedFilterValues(chartId) {
   }
   return appliedFilterValuesByChart[chartId];
 }
+export function getChartIdsInFilterScope(filterScope, charts, layout) {
+  const layoutItems = Object.values(layout);
+  return Object.values(charts)
+    .filter(
+      chart =>
+        !filterScope.excluded.includes(chart.id) &&
+        layoutItems
+          .find(
+            layoutItem =>
+              layoutItem?.type === CHART_TYPE &&
+              layoutItem.meta?.chartId === chart.id,
+          )
+          ?.parents?.some(elementId =>
+            filterScope.rootPath.includes(elementId),
+          ),
+    )
+    .map(chart => chart.id);
+}

Review comment:
       Done, good point!

##########
File path: 
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.tsx
##########
@@ -46,16 +46,30 @@ type DashboardContainerProps = {
   topLevelTabs?: LayoutItem;
 };
 
+const useNativeFilterScopes = () => {
+  const nativeFilters = useSelector<RootState, Filters>(
+    state => state.nativeFilters?.filters,
+  );
+  return useMemo(
+    () =>
+      Object.values(nativeFilters ?? {}).map(filter => ({
+        id: filter.id,
+        scope: filter.scope,
+        type: filter.type,
+      })),
+    [JSON.stringify(nativeFilters)],
+  );
+};
+
 const DashboardContainer: FC<DashboardContainerProps> = ({ topLevelTabs }) => {
   const dashboardLayout = useSelector<RootState, DashboardLayout>(
     state => state.dashboardLayout.present,
   );
-  const nativeFilters = useSelector<RootState, Filters>(
-    state => state.nativeFilters?.filters,
-  );
+  const nativeFiltersScopes = useNativeFilterScopes();

Review comment:
       👍 




-- 
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.

To unsubscribe, e-mail: [email protected]

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