Skip to content

Commit 4dd3d73

Browse files
authored
Merge branch 'master' into fix-theme
2 parents f81fa95 + 27197fa commit 4dd3d73

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,3 +438,23 @@ test('should handle metrics without labels', () => {
438438
expect(grid!.rowHeaders).toEqual(['']);
439439
expect(grid!.colHeaders).toEqual(['count']);
440440
});
441+
442+
test('should preserve slice_id and dashboardId for embedded dashboard permissions', () => {
443+
const formDataWithDashboardContext: TestFormData = {
444+
...baseFormData,
445+
slice_id: 42,
446+
dashboardId: 123,
447+
};
448+
449+
const grid = generateMatrixifyGrid(formDataWithDashboardContext);
450+
451+
expect(grid).not.toBeNull();
452+
const cell = grid!.cells[0][0];
453+
454+
// slice_id must be preserved for embedded dashboard permission checks
455+
// The backend uses slice_id to verify the chart belongs to the dashboard
456+
expect(cell!.formData.slice_id).toBe(42);
457+
458+
// dashboardId must be preserved for embedded dashboard context
459+
expect(cell!.formData.dashboardId).toBe(123);
460+
});

‎superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ function generateCellFormData(
125125
});
126126

127127
// Override fields that could cause issues in grid cells
128+
// Note: slice_id is intentionally preserved for embedded dashboard permission checks
128129
const overrides: Partial<QueryFormData> = {
129130
slice_name: undefined,
130-
slice_id: undefined,
131131
header_font_size: undefined,
132132
subheader: undefined,
133133
show_title: undefined,

0 commit comments

Comments
 (0)