aminghadersohi opened a new pull request, #38890: URL: https://github.com/apache/superset/pull/38890
### SUMMARY Fixes `add_chart_to_existing_dashboard` making charts invisible on tabbed dashboards. When `add_chart_to_existing_dashboard` is called on a dashboard with tabs, `_ensure_layout_structure()` was injecting `GRID_ID` into `ROOT_ID.children` even though `TABS` already occupied that position. This caused the new chart's grid row to be placed under a `GRID_ID` that wasn't visible in the tabbed layout, making the chart invisible in the UI. In real Superset dashboards with tabs, the layout hierarchy is: ``` ROOT_ID → TABS → TAB_1/TAB_2 → ROW → CHART ``` The previous code always ensured `GRID_ID` was in `ROOT_ID.children`, which broke the tabbed layout by creating a parallel invisible grid. ### FIX The fix checks whether `TABS` already exists as a child of `ROOT_ID` before injecting `GRID_ID`, preserving the real-world layout pattern where `TABS` is a direct child of `ROOT_ID`. ### TESTING Adds 5 new tests covering tabbed dashboard scenarios: - Tabbed dashboard where TABS is a direct child of ROOT_ID - GRID_ID is not injected when TABS exists in ROOT_ID.children - Chart placement defaults to first tab when TABS exists - Multiple tabs with existing charts - Mixed layout (some tabs + grid) handling All 46 existing + new tests pass. ### BEFORE/AFTER **Before**: Calling `add_chart_to_existing_dashboard` on a tabbed dashboard creates the chart under an invisible `GRID_ID` node parallel to `TABS`, making the chart not visible in the UI. **After**: The chart is correctly placed within the first tab of the tabbed layout and is visible in the UI. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
