Skip to content

Commit

Permalink
Don't run for non-chart type elements
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Feb 27, 2023
1 parent 494f8b3 commit 75ed49f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions superset-frontend/src/dashboard/util/crossFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
Behavior,
FeatureFlag,
getChartMetadataRegistry,
isDefined,
isFeatureEnabled,
} from '@superset-ui/core';
import { DASHBOARD_ROOT_ID } from './constants';
Expand All @@ -36,7 +37,7 @@ export const isCrossFiltersEnabled = (
export const getCrossFiltersConfiguration = (
dashboardLayout: DashboardLayout,
initialConfig: DashboardInfo['metadata']['chart_configuration'] = {},
chartQueries: ChartsState,
charts: ChartsState,
) => {
if (!isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS)) {
return undefined;
Expand All @@ -46,11 +47,15 @@ export const getCrossFiltersConfiguration = (
const chartConfiguration = {};
Object.values(dashboardLayout).forEach(layoutItem => {
const chartId = layoutItem.meta?.chartId;

if (!isDefined(chartId)) {
return;
}

const behaviors =
(
getChartMetadataRegistry().get(
chartQueries[chartId]?.form_data?.viz_type,
) ?? {}
getChartMetadataRegistry().get(charts[chartId]?.form_data?.viz_type) ??
{}
)?.behaviors ?? [];

if (behaviors.includes(Behavior.INTERACTIVE_CHART)) {
Expand All @@ -71,7 +76,7 @@ export const getCrossFiltersConfiguration = (
chartConfiguration[chartId].crossFilters.chartsInScope =
getChartIdsInFilterScope(
chartConfiguration[chartId].crossFilters.scope,
chartQueries,
charts,
dashboardLayout,
);
}
Expand Down

0 comments on commit 75ed49f

Please sign in to comment.