fix(dashboard): apply dynamic groupby display controls to scoped charts#39356
fix(dashboard): apply dynamic groupby display controls to scoped charts#39356richardfogaca wants to merge 4 commits intoapache:masterfrom
Conversation
Code Review Agent Run #3efc58Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
superset-frontend/src/dashboard/util/getFormDataWithExtraFilters.test.ts
Outdated
Show resolved
Hide resolved
superset-frontend/src/dashboard/util/getFormDataWithExtraFilters.test.ts
Outdated
Show resolved
Hide resolved
superset-frontend/src/dashboard/util/getFormDataWithExtraFilters.test.ts
Outdated
Show resolved
Hide resolved
superset-frontend/src/dashboard/util/getFormDataWithExtraFilters.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Fixes dashboard Dynamic Group By display controls so scoped charts receive correct groupby updates (and no longer get incorrect filter injections), including improved handling of legacy chart customization metadata.
Changes:
- Remove the spurious “selected column as filter value” injection path and ensure dynamic group-by selections are applied as chart dimensions.
- Normalize single-select dynamic group-by values (string → one-item array) and deduplicate chord
groupby. - Normalize/migrate legacy chart customization config before scope calculation, and add regression tests for
getFormDataWithExtraFiltersandDashboardContainer.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
superset-frontend/src/dashboard/util/getFormDataWithExtraFilters.test.ts |
Adds focused regression coverage for dynamic group-by behavior and scoping edge cases. |
superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts |
Fixes dynamic group-by form-data generation (remove filter injection, normalize single-select, chord dedupe). |
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.tsx |
Migrates legacy chart customization items before scope calculation. |
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.test.tsx |
Adds tests validating charts-in-scope calculation for chart customizations, including legacy format migration. |
Comments suppressed due to low confidence (1)
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.tsx:212
- The legacy normalization + calculateScopes path can incorrectly expand a legacy chart customization that was previously scoped via
chartId.migrateChartCustomization()setschartsInScope: [legacy.chartId], butcalculateScopes()ignoreschartsInScopeand recomputes it solely fromitem.scope; the migrated legacy scope defaults to{ rootPath: [DASHBOARD_ROOT_ID], excluded: [] }, which will put all charts in scope and thensetInScopeStatusOfCustomizationspersists that broadened scope back into metadata.
To preserve legacy per-chart scoping, consider special-casing legacy items that include chartId when building normalizedCustomizations (e.g., after migration, set scope.excluded to chartIds.filter(id => id !== legacy.chartId) or otherwise derive a scope that yields only the intended chart(s) in calculateScopes).
// Normalize legacy chart customizations before scope calculation.
const hasLegacy = chartCustomizations.some(
isLegacyChartCustomizationFormat,
);
const normalizedCustomizations = hasLegacy
? migrateChartCustomizationArray(chartCustomizations)
: chartCustomizations;
const scopes = calculateScopes(
normalizedCustomizations,
chartIds,
chartLayoutItems,
item => item.type === ChartCustomizationType.Divider,
).map(scope => ({
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.test.tsx
Show resolved
Hide resolved
superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (99.81%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #39356 +/- ##
==========================================
+ Coverage 64.45% 64.54% +0.09%
==========================================
Files 2555 2555
Lines 132721 132730 +9
Branches 30802 30808 +6
==========================================
+ Hits 85539 85667 +128
+ Misses 45696 45577 -119
Partials 1486 1486
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review Agent Run #4360c0Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #940d46Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
groupby.groupbyarray shape.getFormDataWithExtraFiltersandDashboardContainer.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE
Selecting status should only change the chart grouping. Before this fix, the frontend could also treat status as a row filter value

AFTER
The same interaction now updates groupby correctly without adding the bogus status IN ('status') filter.

TESTING INSTRUCTIONS
groupbyfield and add it to a dashboard.groupbyand without a spuriousfiltersclause containing the selected column name as a value.Automated:
npm run test -- src/dashboard/util/getFormDataWithExtraFilters.test.tsnpm run test -- src/dashboard/components/DashboardBuilder/DashboardContainer.test.tsxValidation note:
pre-commit run --all-fileswas executed in the isolated worktree, but the frontend type-check step hits existing baseline declaration issues unrelated to this patch (dom-to-image-more/dom-to-pdfresolution insrc/utils/downloadAsImage.tsxandsrc/utils/downloadAsPdf.ts).ADDITIONAL INFORMATION