fix: Time Comparison Feature Reverts Metric Labels to Metric Keys in Table Charts#32665
Conversation
There was a problem hiding this comment.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
| Category | Issue | Fix Detected |
|---|---|---|
| Missing error logging for originalLabel fallback ▹ view | ✅ | |
| Unclear relationship between label properties ▹ view | ✅ |
Files scanned
| File Path | Reviewed |
|---|---|
| superset-frontend/plugins/plugin-chart-table/src/types.ts | ✅ |
| superset-frontend/plugins/plugin-chart-table/src/transformProps.ts | ✅ |
| superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Need a new review? Comment
/korbit-reviewon this PR and I'll review your latest changes.Korbit Guide: Usage and Customization
Interacting with Korbit
- You can manually ask Korbit to review your PR using the
/korbit-reviewcommand in a comment at the root of your PR.- You can ask Korbit to generate a new PR description using the
/korbit-generate-pr-descriptioncommand in any comment on your PR.- Too many Korbit comments? I can resolve all my comment threads if you use the
/korbit-resolvecommand in any comment on your PR.- On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
- Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.
Customizing Korbit
- Check out our docs on how you can make Korbit work best for you and your team.
- Customize Korbit for your organization through the Korbit Console.
Feedback and Support
| // Use a proper logging function if available | ||
| console.debug( | ||
| `originalLabel not found for column at index ${value[0]}, using key as fallback`, | ||
| ); |
There was a problem hiding this comment.
| // Use a proper logging function if available | |
| console.debug( | |
| `originalLabel not found for column at index ${value[0]}, using key as fallback`, | |
| ); |
Antonio-RiveroMartnez
left a comment
There was a problem hiding this comment.
Adding extra processing using the label + the comparison ones like we do for the key and not include a new property is also an option, but I have not strong preference and these changes look like a less risky fix. Thanks for taking care of this!
|
This looks good @fardin-developer. Can you please add a test for this change? |
Thank you, I’ll include a test with the PR. |
|
@geido Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments |
|
@geido Ephemeral environment spinning up at http://35.94.39.180:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup. |
|
Thanks @fardin-developer, I tested on the ephemeral and it looks great! |
Glad to hear it worked out! Thanks for the update. |
…Table Charts (apache#32665) Co-authored-by: Fardin Mustaque <fardinmustaque@Fardins-Mac-mini.local> (cherry picked from commit 7d77dc4)
Table chart column headers were rendering with `id="header-undefined"` instead of meaningful IDs, breaking CSS customization and ARIA accessibility. **Root Cause:** PR #31590 (Ant Design v5) changed header IDs from `column.key` to `column.originalLabel`, but `originalLabel` is only set for time-comparison columns (added in PR #32665), leaving regular columns with undefined values. **Solution:** Implemented defensive fallback with sanitization: - Headers: `id="header-${sanitizeHeaderId(column.originalLabel || column.key)}"` - Cells: `aria-labelledby="header-${sanitizeHeaderId(column.originalLabel || column.key)}"` **Sanitization Required:** Column identifiers can contain CSS-unsafe characters (%, #, △, spaces), so added sanitization function to ensure valid CSS selectors and ARIA references. **Changes:** - Added `sanitizeHeaderId()` helper function - Updated header `id` attribute with fallback + sanitization - Updated cell `aria-labelledby` with fallback + sanitization - Added 2 comprehensive tests (regular + time-comparison columns) - Fixed test fixture mutation issue **Tests verify:** - No "undefined" in any header IDs - All IDs are CSS-safe (no spaces or special characters) - All ARIA relationships valid (cells reference existing headers) - Works for both regular and time-comparison columns Fixes #35783 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…Table Charts (apache#32665) Co-authored-by: Fardin Mustaque <fardinmustaque@Fardins-Mac-mini.local>
Fixes: #32621
FEATURE_CHART_PLUGINS_EXPERIMENTAL=true
SUMMARY
This PR addresses an issue where, with Time Comparison enabled in the Table Chart, the metric name ignores the defined label and instead uses the metric key. This results in an unfriendly display name in the UI.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
###Changes
BEFORE/AFTER SCREENSHOTS
Before
After