bikash-barnwal opened a new pull request, #43192:
URL: https://github.com/apache/superset/pull/43192

   ### SUMMARY
   
   Clicking a pie's **Total** text, its aggregated **Other** slice, or an 
unnamed sector emitted a cross-filter with no dimension values, so downstream 
charts filtered on nothing.
   
   `getCrossFilterDataMask` built a mask from whatever name was clicked. For a 
name with no `labelMap` entry:
   
   ```ts
   const groupbyValues = values.map(value => labelMap[value]).filter(Boolean);
   ```
   
   `groupbyValues` came out empty while `values` stayed non-empty, so the 
`values.length === 0` guard never fired. The mask was still built, and since 
`[].every(...)` is `true`, **every** groupby column was emitted as `IS NULL`.
   
   The fix returns `undefined` when the clicked name is empty, or absent from 
`labelMap` and not currently selected. That is already how 
`contextMenuEventHandler` behaves when `labelMap` has no entry, and 
`crossFilter` is an optional field on `ContextMenuFilters`, so `undefined` is 
the shape callers expect — `clickEventHandler` already guards with `?.dataMask`.
   
   Deselection is untouched: a value present in `selectedValues` was resolvable 
when it was selected, so it still takes the deselect path. The filter branch 
additionally treats empty `groupbyValues` as "no filters", so a stale selection 
cannot rebuild the same bogus mask.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before: clicking **Total** applied `IS NULL` on every groupby column to the 
dashboard.
   After: the click is inert; only real sectors emit filters.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend
   npm run test -- plugins/plugin-chart-echarts/test
   ```
   
   **776 tests across 69 suites pass.** Four new cases name #42340; two of them 
fail on unpatched source (`Total: 1234` and `Other` clicks, and the empty-name 
click). The other two — the context-menu path and clearing the last selected 
value — already behaved correctly and are included as regression guards so the 
new early return cannot break them.
   
   Manually: dashboard with cross-filtering on, a Pie chart with **Show Total** 
(and optionally **Threshold for Other**), plus a second chart. Click the total 
text and the Other slice; no filter should be applied, while clicking a real 
sector still filters.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #42340
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to