This is an automated email from the ASF dual-hosted git repository. sadpandajoe pushed a commit to branch fix-matrixify-multi-chart-layout-2 in repository https://gitbox.apache.org/repos/asf/superset.git
commit 68a9d881d4aa94d801283af5a29208f947b5823d Author: sadpandajoe <[email protected]> AuthorDate: Fri Sep 25 01:33:50 2026 +0000 test(matrixify): cover metrics-axis fan-out to query-specific metrics fields Mixed Chart (viz_type mixed_timeseries, queryObjectCount 2) reads its second query's metric from `metrics_b`, separate from the primary `metrics` field. A Matrixify metrics-axis grid currently only overwrites `metrics`/`metric` per cell, so `metrics_b` stays frozen at the base chart's original value in every cell instead of varying with the matrix. This regression test is red until the next commit's fix lands. Co-Authored-By: Claude Sonnet 5 <[email protected]> --- .../Matrixify/MatrixifyGridGenerator.test.ts | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.test.ts b/superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.test.ts index 2ba91742291..1972bfaebd7 100644 --- a/superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.test.ts +++ b/superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.test.ts @@ -206,6 +206,45 @@ test('should add dimension filters to every query-specific adhoc filter collecti ); }); +test('should apply a metrics-axis selection to every query-specific metrics collection', () => { + // Multi-query charts (e.g. Mixed Chart) read each query's metrics from a + // separate collection. When the matrix axis is in "metrics" mode, the + // metric chosen for a cell must reach all of them, not just the primary + // `metrics` field, or the secondary query renders identically in every + // cell of the grid. + const mixedChartFormData: TestFormData = { + viz_type: 'mixed_timeseries', + datasource: '1__table', + matrixify_enable: true, + matrixify_mode_rows: 'metrics', + matrixify_mode_columns: 'disabled', + matrixify_rows: [createAdhocMetric('Revenue'), createAdhocMetric('Profit')], + metrics: [createAdhocMetric('Original Primary')], + metrics_b: [createAdhocMetric('Original Secondary')], + }; + + const grid = generateMatrixifyGrid(mixedChartFormData); + + expect(grid).not.toBeNull(); + const revenueCell = grid!.cells[0][0]!; + const profitCell = grid!.cells[1][0]!; + + expect(revenueCell.formData.metrics).toEqual([createAdhocMetric('Revenue')]); + expect(revenueCell.formData.metrics_b).toEqual([ + createAdhocMetric('Revenue'), + ]); + expect(revenueCell.formData.metric).toEqual(createAdhocMetric('Revenue')); + + expect(profitCell.formData.metrics).toEqual([createAdhocMetric('Profit')]); + expect(profitCell.formData.metrics_b).toEqual([createAdhocMetric('Profit')]); + expect(profitCell.formData.metric).toEqual(createAdhocMetric('Profit')); + + // The base formData's collection is untouched by either cell's override. + expect(mixedChartFormData.metrics_b).toEqual([ + createAdhocMetric('Original Secondary'), + ]); +}); + test('should generate grid for mixed mode (metrics rows, dimensions columns)', () => { const mixedFormData: TestFormData = { viz_type: 'table',
