Skip to content

fix(bugs): fixing bugs for world map chart#38030

Merged
alexandrusoare merged 5 commits intomasterfrom
alexandrusoare/fix/world-map
Feb 27, 2026
Merged

fix(bugs): fixing bugs for world map chart#38030
alexandrusoare merged 5 commits intomasterfrom
alexandrusoare/fix/world-map

Conversation

@alexandrusoare
Copy link
Copy Markdown
Contributor

@alexandrusoare alexandrusoare commented Feb 17, 2026

SUMMARY

This PR fixes two issues with the World Map chart:

  1. Right-click error (TypeError: onContextMenu is not a function)
  2. Row count shows "0 rows" for legacy charts

Issue 1: Right-Click Error

Symptoms: Right-clicking on any country throws TypeError: onContextMenu is not a function

Root Cause: The onContextMenu hook is called without a null check in WorldMap.ts. This hook is only provided when charts are rendered on a Dashboard with the DrillToDetail feature flag enabled. In other contexts (e.g., Explore view), onContextMenu is undefined.

Fix: Added defensive guard before calling onContextMenu:

if (onContextMenu) {
  onContextMenu(pointerEvent.clientX, pointerEvent.clientY, { ... });
}

Issue 2: Row Count Shows "0 rows"

Symptoms: Legacy charts display "0 rows" despite rendering data correctly

Root Cause: The frontend expects sql_rowcount from query responses, but legacy charts (using useLegacyApi: true) only return rowcount. Both values are computed identically in the backend (len(df.index)), but the legacy API in viz.py doesn't include sql_rowcount.

Fix: Updated frontend components to fall back to rowcount when sql_rowcount is unavailable:

sql_rowcount ?? rowcount ?? 0

Impact: This fix benefits all 16 legacy chart plugins that use useLegacyApi: true, not just World Map.

Additional Fix: Country Tooltips Not Appearing

Context: The World Map chart has two tooltip systems - one for country shapes and one for bubbles. The bubble tooltips were working fine, but the country tooltips were broken.

Root Cause:

  1. The Datamaps constructor received processedData (an array) instead of mapData (a keyed object). Datamaps requires {USA: {...}, CAN: {...}} format to populate tooltip data.
  2. PR 37716 added mouseover/mouseout handlers that replaced Datamaps' built-in tooltip handlers instead of adding to them.

Solution:

  • Changed data: processedData → data: mapData
  • Added null-safety to popupTemplate callback
  • Used namespaced events (mouseover.fillPreserve) to preserve Datamaps' handlers

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE

Screen.Recording.2026-02-17.at.14.37.36.mov

AFTER

Screen.Recording.2026-02-17.at.14.35.46.mov

TESTING INSTRUCTIONS

  1. Create a World Map chart with country data
  2. Verify right-click doesn't crash in Explore view
  3. Verify right-click shows context menu on Dashboard (with DrillToDetail enabled)
  4. Verify row count displays actual number of rows

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@alexandrusoare alexandrusoare marked this pull request as ready for review February 18, 2026 11:54
@dosubot dosubot Bot added the change:frontend Requires changing the frontend label Feb 18, 2026
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Feb 18, 2026

Code Review Agent Run #b49483

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: 97fad0b..2a7b697
    • superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.ts
    • superset-frontend/plugins/legacy-plugin-chart-world-map/test/WorldMap.test.ts
    • superset-frontend/src/dashboard/components/SliceHeader/index.tsx
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
    • superset-frontend/src/explore/components/ChartPills.tsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Copy Markdown
Contributor

@EnxDev EnxDev left a comment

Choose a reason for hiding this comment

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

LGTM!

@pull-request-size pull-request-size Bot added size/L and removed size/M labels Feb 24, 2026
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Feb 24, 2026

Code Review Agent Run #755cc8

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: 2a7b697..2f74e7b
    • superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.ts
    • superset-frontend/plugins/legacy-plugin-chart-world-map/test/WorldMap.test.ts
    • superset-frontend/src/dashboard/components/SliceHeader/index.tsx
    • superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
    • superset-frontend/src/explore/components/ChartPills.tsx
    • superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

.on('click', handleClick)
.on('mouseover', function onMouseOver() {
// Use namespaced events to avoid overriding Datamaps' default tooltip handlers
.on('mouseover.fillPreserve', function onMouseOver() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pretty cool we can do namespaced events with d3

@bito-code-review
Copy link
Copy Markdown
Contributor

This question isn’t related to the pull request. I can only help with questions about the PR’s code or comments.

@alexandrusoare alexandrusoare added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Feb 25, 2026
@github-actions github-actions Bot added 🎪 2f74e7b 🚦 building 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Feb 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 2f74e7b

@msyavuz msyavuz added the hold:testing! On hold for testing label Feb 26, 2026
@alexandrusoare alexandrusoare added 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR and removed testenv-up 🎪 ⌛ 48h Environment expires after 48 hours (default) labels Feb 26, 2026
@github-actions github-actions Bot added 🎪 2db22a4 🚦 building 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Feb 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 2db22a4

@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for 2db22a4

Environment: http://34.220.14.23:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@sadpandajoe sadpandajoe removed the hold:testing! On hold for testing label Feb 27, 2026
@alexandrusoare alexandrusoare merged commit 7743183 into master Feb 27, 2026
88 of 92 checks passed
@alexandrusoare alexandrusoare deleted the alexandrusoare/fix/world-map branch February 27, 2026 09:33
aminghadersohi pushed a commit to preset-io/superset that referenced this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend plugins size/L 🎪 ⌛ 48h Environment expires after 48 hours (default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants