fparodimoraes opened a new pull request, #43731:
URL: https://github.com/apache/superset/pull/43731

   ### SUMMARY
   
   Fixes #43728.
   
   `PartitionViz.nest_values` (and `transformData.ts`'s equivalent frontend 
re-implementation for the v1 chart data API) return `name` as an array of the 
full ancestor path (e.g. `["a", "a.1", "a.1.1"]`) for any node below the first 
grouping level, instead of a plain leaf string. `Partition.ts`'s renderer was 
never updated to expect this, so every consumer of `node.name` -- the sort 
comparator, tooltip cell, on-chart segment label, and categorical color key -- 
treated it as a plain string. JS silently stringifies an array via 
`Array.prototype.toString()` wherever it's interpolated into a template 
literal, so a 3rd-level segment rendered as e.g. `"a,a.1,a.1.1"` instead of 
just `"a.1.1"`.
   
   This fix normalizes `name` to its own leaf value right where it's read from 
`data`, before any of those consumers run -- a single-point fix. It also widens 
the `PartitionDataNode` type and the `PropTypes` declarations to reflect the 
real `string | string[]` contract, instead of leaving them declared (and 
asserted) as `string` while actually receiving arrays.
   
   Verified against a real 4-dimension Partition chart with 12,907 nodes: 0 
arrays remained after the fix, and every node's displayed name matched the 
correct leaf value from the original payload. See #43728 for the full analysis, 
screenshots, and repro SQL.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   See #43728 for before/after screenshots from a real Superset instance using 
the exact repro SQL below.
   
   ### TESTING INSTRUCTIONS
   
   Minimal repro (from #43728) -- register as a virtual dataset, build a 
Partition Chart with metric `SUM(val)` and Levels = `category`, `subcategory`, 
`sub_subcategory`:
   
   ```sql
   SELECT 'B' AS category, 'B1' AS subcategory, NULL AS sub_subcategory, 2 AS 
val
   UNION ALL
   SELECT 'A' AS category, 'A1' AS subcategory, 'A1a' AS sub_subcategory, 1 AS 
val
   UNION ALL
   SELECT 'A' AS category, 'A1' AS subcategory, 'A1b' AS sub_subcategory, 1 AS 
val
   ```
   
   Before this fix, the 3rd-level segments are labeled `A,A1,A1a` / `A,A1,A1b`. 
After, they read `A1a` / `A1b`.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: #43728
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


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