This is an automated email from the ASF dual-hosted git repository.
jli 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 3b656f9cc2 fix(dashboard): restore filterState prop for cross-filter
functionality (#38349)
3b656f9cc2 is described below
commit 3b656f9cc2fcdb754275cb782ee91df4296c933a
Author: Evan Rusackas <[email protected]>
AuthorDate: Wed Mar 4 14:05:21 2026 -0500
fix(dashboard): restore filterState prop for cross-filter functionality
(#38349)
Co-authored-by: Claude Opus 4.6 <[email protected]>
---
superset-frontend/src/components/Chart/Chart.tsx | 2 ++
.../components/gridComponents/Chart/Chart.test.tsx | 30 ++++++++++++++++++++++
.../components/gridComponents/Chart/Chart.tsx | 1 +
3 files changed, 33 insertions(+)
diff --git a/superset-frontend/src/components/Chart/Chart.tsx
b/superset-frontend/src/components/Chart/Chart.tsx
index a65ee1912f..a9797f4f56 100644
--- a/superset-frontend/src/components/Chart/Chart.tsx
+++ b/superset-frontend/src/components/Chart/Chart.tsx
@@ -26,6 +26,7 @@ import {
SqlaFormData,
ClientErrorObject,
DataRecordFilters,
+ type FilterState,
type JsonObject,
type AgGridChartState,
} from '@superset-ui/core';
@@ -89,6 +90,7 @@ export interface ChartProps {
onChartStateChange?: (chartState: AgGridChartState) => void;
/** Whether to suppress the loading spinner (during auto-refresh) */
suppressLoadingSpinner?: boolean;
+ filterState?: FilterState;
}
export type Actions = {
diff --git
a/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx
b/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx
index 7ef19dce5f..0012830ed0 100644
---
a/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx
+++
b/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx
@@ -29,6 +29,15 @@ import chartQueries, {
} from 'spec/fixtures/mockChartQueries';
import Chart from './Chart';
+let capturedChartContainerProps: Record<string, unknown> = {};
+jest.mock('src/components/Chart/ChartContainer', () => {
+ const MockChartContainer = (props: Record<string, unknown>) => {
+ capturedChartContainerProps = props;
+ return <div data-test="chart-container" />;
+ };
+ return { __esModule: true, default: MockChartContainer };
+});
+
const props = {
id: queryId,
width: 100,
@@ -452,3 +461,24 @@ test('should merge base ownState with converted chart
state', () => {
expect(getByTestId('chart-container')).toBeInTheDocument();
});
+
+test('should pass filterState from dataMask to ChartContainer', () => {
+ const mockFilterState = { value: ['bar'], selectedValues: ['bar'] };
+
+ setup(
+ {},
+ {
+ ...defaultState,
+ dataMask: {
+ [queryId]: {
+ filterState: mockFilterState,
+ },
+ },
+ },
+ );
+
+ expect(capturedChartContainerProps).toHaveProperty(
+ 'filterState',
+ mockFilterState,
+ );
+});
diff --git
a/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
b/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
index 0dda657a02..cbf930183b 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
@@ -761,6 +761,7 @@ const Chart = (props: ChartProps) => {
emitCrossFilters={emitCrossFilters}
onChartStateChange={handleChartStateChange}
suppressLoadingSpinner={suppressLoadingSpinner}
+ filterState={dataMask[props.id]?.filterState}
/>
</ChartWrapper>