Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(explore): prevent TypeError when chart dimension returns empty string#38276

Open
EnxDev wants to merge 3 commits intomasterfrom
enxdev/fix/echarts
Open

fix(explore): prevent TypeError when chart dimension returns empty string#38276
EnxDev wants to merge 3 commits intomasterfrom
enxdev/fix/echarts

Conversation

@EnxDev
Copy link
Contributor

@EnxDev EnxDev commented Feb 26, 2026

SUMMARY

When a chart dimension returns an empty string; for example, using coalesce(address_line2, '') as a dimension on a Line Chart; the Results tab in the Explore view crashes with TypeError: n.includes is not a function, and the loading spinner appears frozen.

The root cause is in useTableColumns, which uses id: key || index as a fallback when the column key is empty. Since empty string is falsy in JavaScript, the expression evaluates to index; a number. This numeric ID then flows downstream into mapColumns in TableCollection/utils.tsx, where column.id?.includes('.') is called. Optional chaining (?.) only guards against null and undefined, not non-string types, so calling .includes() on a number throws a TypeError.

The fix applies two layers of defense:

At the source ([DataTableControl/index.tsx]): Coerce the fallback index to a string with String(index), ensuring column.id is always a string regardless of whether the column key is empty.

At the call site ([TableCollection/utils.tsx]: Add an explicit typeof column.id === 'string' guard before calling .includes('.'), so that even if a numeric ID somehow reaches this code path in the future, it won't crash.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

  • Before
before.mp4
  • After
after.mov

TESTING INSTRUCTIONS

  1. Create a dataset with a column that can contain empty strings (e.g., address_line2)
  2. Create a Line Chart (ECharts Timeseries) using coalesce(address_line2, '') as a dimension
  3. Open the Results tab in the Explore view
  4. Click "Create chart"; verify the Results table renders without crashing
  5. Verify the chart itself renders correctly

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

@EnxDev EnxDev marked this pull request as ready for review February 27, 2026 08:33
@dosubot dosubot bot added the explore Namespace | Anything related to Explore label Feb 27, 2026
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 27, 2026

Code Review Agent Run #00eb26

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: a1b0ad4..a1b0ad4
    • superset-frontend/packages/superset-ui-core/src/components/TableCollection/utils.tsx
    • superset-frontend/src/explore/components/DataTableControl/index.tsx
  • Files skipped - 0
  • Tools
    • 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines +95 to +98
dataIndex:
typeof column.id === 'string' && column.id.includes('.')
? column.id.split('.')
: column.id,
Copy link
Member

Choose a reason for hiding this comment

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

What is the type column id if not a string? Should we make it so that it always is a string?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is already defined as string, probably this check is redundant, I'll remove it

@netlify
Copy link

netlify bot commented Feb 27, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit cead872
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69a1b9ba6bfc2b00086c63fa
😎 Deploy Preview https://deploy-preview-38276--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 27, 2026

Code Review Agent Run #f0f4cf

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: a1b0ad4..cead872
    • superset-frontend/packages/superset-ui-core/src/components/TableCollection/utils.tsx
  • Files skipped - 0
  • Tools
    • 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions bot removed the packages label Mar 1, 2026
@EnxDev EnxDev added hold:testing! On hold for testing packages labels Mar 1, 2026
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Mar 1, 2026

Code Review Agent Run #7195d7

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: cead872..007b33c
    • superset-frontend/packages/superset-ui-core/src/components/TableCollection/utils.tsx
  • Files skipped - 0
  • Tools
    • 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@sadpandajoe sadpandajoe added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Mar 3, 2026
@github-actions github-actions bot added 🎪 007b33c 🚦 building Environment 007b33c status: building 🎪 007b33c 📅 2026-03-03T00-11 Environment 007b33c created at 2026-03-03T00-11 🎪 007b33c 🤡 sadpandajoe Environment 007b33c requested by sadpandajoe and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

🎪 Showtime is building environment on GHA for 007b33c

@github-actions github-actions bot added 🎪 ⌛ 48h Environment expires after 48 hours (default) 🎪 007b33c 🚦 deploying Environment 007b33c status: deploying 🎪 007b33c 🚦 running Environment 007b33c status: running 🎪 🎯 007b33c Active environment pointer - 007b33c is receiving traffic and removed 🎪 007b33c 🚦 building Environment 007b33c status: building 🎪 007b33c 🚦 deploying Environment 007b33c status: deploying labels Mar 3, 2026
@github-actions github-actions bot added 🎪 007b33c 🚦 running Environment 007b33c status: running 🎪 007b33c 🌐 35.91.65.234:8080 Environment 007b33c URL: http://35.91.65.234:8080 (click to visit) and removed 🎪 007b33c 🚦 running Environment 007b33c status: running 🎪 🎯 007b33c Active environment pointer - 007b33c is receiving traffic labels Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

🎪 Showtime deployed environment on GHA for 007b33c

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

explore Namespace | Anything related to Explore hold:testing! On hold for testing packages size/XS 🎪 007b33c 🚦 running Environment 007b33c status: running 🎪 007b33c 🤡 sadpandajoe Environment 007b33c requested by sadpandajoe 🎪 007b33c 🌐 35.91.65.234:8080 Environment 007b33c URL: http://35.91.65.234:8080 (click to visit) 🎪 007b33c 📅 2026-03-03T00-11 Environment 007b33c created at 2026-03-03T00-11 🎪 ⌛ 48h Environment expires after 48 hours (default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants