Skip to content

Commit 634e97b

Browse files
fix(dashboard): enable cross-filtering across tabs
1 parent cbb2b2f commit 634e97b

File tree

2 files changed

+8
-36
lines changed

2 files changed

+8
-36
lines changed

superset-frontend/src/dashboard/util/crossFilters.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,10 @@ export const getCrossFiltersConfiguration = (
9898
},
9999
};
100100
}
101-
chartConfiguration[chartId].crossFilters.chartsInScope =
102-
isCrossFilterScopeGlobal(chartConfiguration[chartId].crossFilters.scope)
103-
? globalChartConfiguration.chartsInScope.filter(
104-
id => id !== Number(chartId),
105-
)
106-
: getChartIdsInFilterScope(
107-
chartConfiguration[chartId].crossFilters
108-
.scope as NativeFilterScope,
109-
Object.values(charts).map(chart => chart.id),
110-
chartLayoutItems,
111-
);
101+
chartConfiguration[chartId].crossFilters.chartsInScope =
102+
Object.values(charts)
103+
.map(chart => chart.id)
104+
.filter(id => id !== Number(chartId));
112105
}
113106
});
114107

superset-frontend/src/dashboard/util/getRelatedCharts.ts

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,10 @@ function getRelatedChartsForCrossFilter(
5555
slices: Record<string, Slice>,
5656
scope: number[],
5757
): number[] {
58-
const sourceSlice = slices[filterKey];
59-
60-
if (!sourceSlice) return [];
61-
62-
const fullScope = [
63-
...scope.filter(s => String(s) !== filterKey),
64-
Number(filterKey),
65-
];
66-
const scopeSet = new Set(scope);
67-
68-
return Object.values(slices).reduce((result: number[], slice) => {
69-
if (slice.slice_id === Number(filterKey)) {
70-
return result;
71-
}
72-
// Check if it's in the global scope
73-
if (isGlobalScope(fullScope, slices)) {
74-
result.push(slice.slice_id);
75-
return result;
76-
}
77-
// Check if it's hand-picked in scope
78-
if (scopeSet.has(slice.slice_id)) {
79-
result.push(slice.slice_id);
80-
}
81-
return result;
82-
}, []);
58+
// Always return all charts except source chart
59+
return Object.values(slices)
60+
.map(slice => slice.slice_id)
61+
.filter(id => id !== Number(filterKey));
8362
}
8463

8564
export function getRelatedCharts(

0 commit comments

Comments
 (0)