Repository navigation
fix(echarts): guard cross-filter when labelMap entry is missing - #42559
Conversation
Code Review Agent Run #0e7c33Actionable 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 |
|
The flagged issue is correct. Returning early when To resolve this, you should only return early if the value is not currently selected. If the value is already selected, it must proceed to the deselection logic to allow the filter to be cleared. Proposed Fix const selected = Object.values(selectedValues);
if (!labelMap[value] && !selected.includes(value)) {
return undefined;
}This change ensures that unknown values are only ignored if they are not part of the current selection, allowing selected unknown values to be processed for deselection. superset-frontend/plugins/plugin-chart-echarts/src/utils/eventHandlers.ts |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #42559 +/- ##
=======================================
Coverage 66.69% 66.70%
=======================================
Files 2872 2872
Lines 163452 163454 +2
Branches 37725 37726 +1
=======================================
+ Hits 109022 109024 +2
Misses 52302 52302
Partials 2128 2128
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
One thing before I approve. Codeant's thread here is still open: the early return also blocks deselecting an already-selected |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #414ad3Actionable 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 |
…pache#42340) Return undefined when the clicked series is absent from labelMap (e.g. Pie "Other") so an invalid cross-filter is not applied. Add a regression test for this case. Co-authored-by: Cursor <[email protected]>
The early return for unknown labelMap entries ran before checking whether the value was already selected, so a stale/unknown selected value (e.g. "Other") could never be cleared by clicking it again. Only short-circuit when the value isn't currently selected. Co-Authored-By: Claude Opus 4.8 <[email protected]>
558f800 to
8273cd3
Compare
Code Review Agent Run #2bfe9eActionable 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 |
rusackas
left a comment
There was a problem hiding this comment.
The gap I flagged was fixed (by my own follow-up commit) and is all covered by tests, CI is green, and I think we can call this good to go. Bad filters and broken charts are no good, so thanks for tackling this. Approving.
Co-authored-by: Cursor <[email protected]> Co-authored-by: rusackas <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
SUMMARY
Fixes #42340.
When ECharts charts that share
eventHandlers.ts(notably Pie) receive a click whose seriesnameis not inlabelMap— e.g. Pie Other, Total, or an empty/missing name —getCrossFilterDataMaskstill built a data mask. After.filter(Boolean),groupbyValuescould be empty whilevalueswas non-empty, which led to invalid cross-filters (INwith empty values, or unintendedIS NULLbecause[].every(...)istrue). Downstream charts then failed or returned wrong results.This change returns
undefinedearly whenlabelMap[value]is missing, soclickEventHandlerdoes not callsetDataMask. That matches the existing context-menu guard that already no-ops whenlabelMap[e.name]is absent.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (behavior fix; no UI change). See the recording on #42340 for the previous incorrect behavior.
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION