You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2026/03/17 14:59:50 UTC

(superset) 06/29: fix(matrixify): Matrixify to not override slice id (#38515)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 6.1
in repository https://gitbox.apache.org/repos/asf/superset.git

commit cfcaaa9db457b828583ea572384a4fd6b69f2f03
Author: Alexandru Soare <37...@users.noreply.github.com>
AuthorDate: Thu Mar 12 11:39:29 2026 +0200

    fix(matrixify): Matrixify to not override slice id (#38515)
    
    Co-authored-by: Evan Rusackas <ev...@preset.io>
    (cherry picked from commit 27197faba97e7926008f3744e873c107f8e5f05e)
---
 .../Matrixify/MatrixifyGridGenerator.test.ts         | 20 ++++++++++++++++++++
 .../components/Matrixify/MatrixifyGridGenerator.ts   |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)

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 a2915fef438..8f660e1a776 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
@@ -438,3 +438,23 @@ test('should handle metrics without labels', () => {
   expect(grid!.rowHeaders).toEqual(['']);
   expect(grid!.colHeaders).toEqual(['count']);
 });
+
+test('should preserve slice_id and dashboardId for embedded dashboard permissions', () => {
+  const formDataWithDashboardContext: TestFormData = {
+    ...baseFormData,
+    slice_id: 42,
+    dashboardId: 123,
+  };
+
+  const grid = generateMatrixifyGrid(formDataWithDashboardContext);
+
+  expect(grid).not.toBeNull();
+  const cell = grid!.cells[0][0];
+
+  // slice_id must be preserved for embedded dashboard permission checks
+  // The backend uses slice_id to verify the chart belongs to the dashboard
+  expect(cell!.formData.slice_id).toBe(42);
+
+  // dashboardId must be preserved for embedded dashboard context
+  expect(cell!.formData.dashboardId).toBe(123);
+});
diff --git a/superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.ts b/superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.ts
index cc12d396b9e..59c5f9ed733 100644
--- a/superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.ts
+++ b/superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.ts
@@ -125,9 +125,9 @@ function generateCellFormData(
   });
 
   // Override fields that could cause issues in grid cells
+  // Note: slice_id is intentionally preserved for embedded dashboard permission checks
   const overrides: Partial<QueryFormData> = {
     slice_name: undefined,
-    slice_id: undefined,
     header_font_size: undefined,
     subheader: undefined,
     show_title: undefined,