villebro commented on a change in pull request #12662:
URL: https://github.com/apache/superset/pull/12662#discussion_r575042391



##########
File path: superset-frontend/src/dashboard/components/nativeFilters/utils.ts
##########
@@ -93,14 +101,31 @@ export function mergeExtraFormData(
   };
 }
 
+export function isCrossFilter(vizType: string) {
+  // @ts-ignore need export from superset-ui `ItemWithValue`
+  return getChartMetadataRegistry().items[vizType]?.value.behaviors?.includes(
+    Behavior.CROSS_FILTER,
+  );
+}
+
 export function getExtraFormData(
   nativeFilters: NativeFiltersState,
+  charts: Charts,
 ): ExtraFormData {
   let extraFormData: ExtraFormData = {};
   Object.keys(nativeFilters.filters).forEach(key => {
     const filterState = nativeFilters.filtersState[key] || {};
     const { extraFormData: newExtra = {} } = filterState;
     extraFormData = mergeExtraFormData(extraFormData, newExtra);
   });
+  if (isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS)) {
+    Object.entries(charts).forEach(([key, chart]) => {
+      if (isCrossFilter(chart?.formData?.viz_type)) {
+        const filterState = nativeFilters.filtersState[key] || {};
+        const { extraFormData: newExtra = {} } = filterState;
+        extraFormData = mergeExtraFormData(extraFormData, newExtra);
+      }
+    });
+  }

Review comment:
       General comment: it doesn't really matter now, but especially once we 
start using overrides as opposed to appends, the order in which these get 
applied will matter. If possible, we should probably think about some way of 
visually understanding which chart/filter has taken precedent/been overridden.




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