You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/09/04 21:49:58 UTC

(superset) branch master updated: fix(partition): normalize ancestor-path array names to leaf values (#43731)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new ff90a60b09d fix(partition): normalize ancestor-path array names to leaf values (#43731)
ff90a60b09d is described below

commit ff90a60b09dd5a4948b78f81f8aadb88b7145a7a
Author: Facundo Parodi <39...@users.noreply.github.com>
AuthorDate: Fri Sep 4 18:49:50 2026 -0300

    fix(partition): normalize ancestor-path array names to leaf values (#43731)
    
    Co-authored-by: Claude Sonnet 5 <no...@anthropic.com>
---
 .../plugin-chart-partition/src/Partition.ts        | 29 +++++++++++++++++++---
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/plugins/plugin-chart-partition/src/Partition.ts b/superset-frontend/plugins/plugin-chart-partition/src/Partition.ts
index cd57ecc22e8..5e9d259519c 100644
--- a/superset-frontend/plugins/plugin-chart-partition/src/Partition.ts
+++ b/superset-frontend/plugins/plugin-chart-partition/src/Partition.ts
@@ -31,7 +31,12 @@ import {
 } from '@superset-ui/core';
 
 interface PartitionDataNode {
-  name: string;
+  // A plain string for the metric row and the first grouping level;
+  // an array of the full ancestor path (e.g. ["a", "a.1", "a.1.1"])
+  // for any node below that, per PartitionViz.nest_values /
+  // transformData. Consumers should read PartitionNode.name instead,
+  // which is normalized to a plain leaf string in `init`.
+  name: string | string[];
   val: number;
   children?: PartitionDataNode[];
 }
@@ -99,11 +104,21 @@ const lazyFunction = (f: () => Record<string, unknown>) =>
     return f().apply(this, args);
   };
 const leafType = PropTypes.shape({
-  name: PropTypes.string,
+  // A plain string at the first grouping level, or an array of the
+  // full ancestor path at any level below that.
+  name: PropTypes.oneOfType([
+    PropTypes.string,
+    PropTypes.arrayOf(PropTypes.string),
+  ]),
   val: PropTypes.number.isRequired,
 });
 const parentShape = {
-  name: PropTypes.string,
+  // A plain string at the first grouping level, or an array of the
+  // full ancestor path at any level below that.
+  name: PropTypes.oneOfType([
+    PropTypes.string,
+    PropTypes.arrayOf(PropTypes.string),
+  ]),
   val: PropTypes.number.isRequired,
   children: PropTypes.arrayOf(
     PropTypes.oneOfType([
@@ -228,7 +243,13 @@ function Icicle(element: HTMLElement, props: IcicleProps): void {
       n.disp = n.data.val;
       n.value = n.disp < 0 ? -n.disp : n.disp;
       n.weight = n.value;
-      n.name = n.data.name;
+      // n.data.name is an array of the full ancestor path for any node
+      // below the first grouping level; normalize to this node's own
+      // leaf value so sorting, tooltips, on-chart labels, and the
+      // categorical color key all key off a plain string.
+      n.name = Array.isArray(n.data.name)
+        ? n.data.name[n.data.name.length - 1]
+        : n.data.name;
       // If the parent is a metric and we still have
       // the time column, perform a date-time format
       if (n.parent && hasDateNode(n.parent)) {