Skip to content

fix: Fix map data parsing for Superset and Spring Boot payload compat… - #282

Merged
ralvarez-dg merged 4 commits into
mainfrom
fix/fix-map-data-values
Aug 24, 2026
Merged

fix: Fix map data parsing for Superset and Spring Boot payload compat…#282
ralvarez-dg merged 4 commits into
mainfrom
fix/fix-map-data-values

Conversation

@timothygachengo

@timothygachengo timothygachengo commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

…ibility## Description

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (BREAKING CHANGE:)
  • Refactor / chore (refactor: / chore:)
  • Documentation update (docs:)

Affected package(s)

  • @devgateway/dvz-ui-react
  • @devgateway/wp-react-lib
  • example only (no changeset needed)

Checklist

  • PR title follows Conventional Commits format
  • A changeset has been added (pnpm changeset) for any change to a published package
  • pnpm build passes locally
  • pnpm --filter @devgateway/* typecheck passes
  • No hardcoded credentials, internal URLs, client names, or PII introduced
  • Any new dependency has an Apache-2.0-compatible license

Copilot AI lite review requested due to automatic review settings August 24, 2026 11:34
@pkg-pr-new

pkg-pr-new Bot commented Aug 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@devgateway/dvz-ui-react@818474c
pnpm add https://pkg.pr.new/@devgateway/wp-react-lib@818474c

commit: 818474c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the map data transformation logic to better handle differing payload shapes from Superset vs Spring Boot APIs, improving measure parsing and label/value extraction so downstream map/chart components can consume consistent transformedData.

Changes:

  • Make measures parsing resilient to arrays, CSV strings, JSON-array strings, and empty values (fallback to metadata measures).
  • Normalize label/value selection using metadata-aware helpers and add a fallback transformation path for flat aggregate Spring Boot responses (no children).
  • Add a changeset bump for @devgateway/dvz-ui-react.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/dvz-ui/src/embeddable/map/MapDataFrame.jsx Improves measure parsing and transforms Superset/Spring Boot payloads into consistent locationsData/nationalData.
.changeset/busy-spiders-pull.md Patch changeset describing the map parsing compatibility fix.
Suppressed comments (1)

packages/dvz-ui/src/embeddable/map/MapDataFrame.jsx:386

  • The if (item.children) { ... } block that manually builds newItem.children is immediately overwritten by newItem.children = buildChildren(item, measure), so it has no effect and is misleading. Remove the redundant block (or fold the needed behavior into buildChildren) to avoid dead code and inconsistent child shaping.
                if (item.children) {
                    newItem.children = []
                    item.children.forEach(child => {
                        newItem.children.push({...child, label: child.value, value: getMeasureValue(child, measure)});
                    })
                }

                // Handle nested children (Superset format), at any dimension depth
                newItem.children = buildChildren(item, measure);


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/dvz-ui/src/embeddable/map/MapDataFrame.jsx
Copilot AI review requested due to automatic review settings August 24, 2026 11:43
@pkg-pr-new

pkg-pr-new Bot commented Aug 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@devgateway/dvz-ui-react@94fe519
pnpm add https://pkg.pr.new/@devgateway/wp-react-lib@94fe519

commit: 94fe519

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

packages/dvz-ui/src/embeddable/map/MapDataFrame.jsx:383

  • The if (item.children) block builds newItem.children (lines 378-383), but it is immediately overwritten by newItem.children = buildChildren(item, measure) right after. This makes the loop dead code and adds unnecessary work/confusion. Remove the redundant block and keep a single children-normalization path (preferably the recursive buildChildren).

This issue also appears on line 385 of the same file.

                if (item.children) {
                    newItem.children = []
                    item.children.forEach(child => {
                        newItem.children.push({...child, label: child.value, value: getMeasureValue(child, measure)});
                    })
                }

packages/dvz-ui/src/embeddable/map/MapDataFrame.jsx:387

  • Nested breakdown rows come from buildChildren(item, measure), but buildChildren still sets value: child[measure] and label: child.value (see its implementation above). That bypasses the new getMeasureValue / getLocationLabel logic and can produce incorrect tooltip breakdown values/labels for Superset-style payloads where the measure value isn't stored under child[measure] (or where child.value is numeric). Align nested child normalization with the same value/label resolution used for top-level rows.
                // Handle nested children (Superset format), at any dimension depth
                newItem.children = buildChildren(item, measure);

@ralvarez-dg
ralvarez-dg merged commit 3656f3a into main Aug 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants