Skip to content

fix(dashboard): make chart error messages expandable again - #42491

Merged
sadpandajoe merged 3 commits into
apache:masterfrom
preset-io:dashboard-chart-error-expandable
Aug 1, 2026
Merged

sadpandajoe merged 3 commits into
apache:masterfrom
preset-io:dashboard-chart-error-expandable

Conversation

@yousoph

@yousoph yousoph commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

SUMMARY

When a chart fails to render inside a dashboard, the error is shown as a flat, truncated alert with no way to expand it for more detail. The same chart error in Explore still shows an expandable "See more" with the full stack trace.

This is a regression from #31858 ("chore: refactor Alert-related components"), which reworked ErrorAlert so the "See more" toggle only renders when descriptionDetails is truthy. descriptionDetails is derived from link || stackTrace. Explore's ExploreChartPanel forwards chartStackTrace, so its toggle renders; the dashboard chart wrapper (gridComponents/Chart/Chart.tsx) never forwarded chartStackTrace, so descriptionDetails was undefined and no expand affordance appeared.

Changes

  • dashboard/components/gridComponents/Chart/Chart.tsx — forward chartStackTrace into <ChartContainer>, mirroring ExploreChartPanel. Restores "See more" / stack-trace parity for the common case (chart errors that carry a stack trace).
  • components/ErrorMessage/ErrorMessageWithStackTrace.tsx — when the only detail available is the subtitle (no stack trace, link, or explicit descriptionDetails), surface it inside the collapsible "See more" section instead of inline. This guarantees an expand affordance rather than a flat, unexpandable card even when there is no stack trace. Note this path is shared by all ErrorMessageWithStackTrace consumers, not just dashboard charts.

TESTING INSTRUCTIONS

  • Added a regression guard in Chart.test.tsx: the dashboard chart wrapper forwards chartStackTrace to ChartContainer.
  • Added a regression guard in ChartErrorMessage.test.tsx: an error with no stack trace still exposes a "See more" toggle.
  • Manual: open a dashboard containing a chart that errors (e.g. renders in Explore but fails in-dashboard) and confirm the error card now expands via "See more" and shows the detail/stack trace, matching Explore.

Before:
image

After:
image

ADDITIONAL INFORMATION

  • Has associated issue
  • Required feature flags: n/a
  • 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 checks for object existence
  • Introduces new feature or API
  • Removes existing feature or API

Chart render errors inside a dashboard showed as a flat, unexpandable
"Data error" card, while the same error in Explore still offered a
"See more" toggle with the full stack trace. Regression from apache#31858,
which removed the source-based expandable error rendering from
ErrorAlert.

- Forward chartStackTrace from the dashboard Chart wrapper into
  ChartContainer, mirroring ExploreChartPanel, so the stack trace is
  reachable behind "See more".
- In ErrorMessageWithStackTrace, when no stack trace, link, or explicit
  details are available, surface the error subtitle in the collapsible
  section instead of inline, so the alert always offers an expand
  affordance rather than a bare "Data error".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dosubot dosubot Bot added change:frontend Requires changing the frontend dashboard:error Related to Dashboard errors labels Jul 28, 2026
@bito-code-review

bito-code-review Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Bito Review Skipped - Source Branch Not Found

Bito didn’t review this change because the pull request is no longer valid. It may have been merged, or the source/target branch may no longer exist.

@netlify

netlify Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit c769c68
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a6a36e9a8697a0009e89d80
😎 Deploy Preview https://deploy-preview-42491--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

Comment thread superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx Outdated
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The current implementation uses a value comparison (computedDescriptionDetails === subtitle) to decide whether to hide the subtitle, which fails when a caller intentionally provides the same content for both props, causing the primary message to disappear.

To resolve this, you should track whether the fallback logic was triggered rather than comparing the values. You can introduce a boolean flag or check if descriptionDetails was explicitly provided by the caller.

Proposed Fix

Update ErrorMessageWithStackTrace.tsx to distinguish between an explicit descriptionDetails and the fallback:

  // Track if descriptionDetails was explicitly provided
  const hasExplicitDetails = !!descriptionDetails;

  const message = hasExplicitDetails ? undefined : subtitle;

This ensures that if descriptionDetails is provided (even if it matches the subtitle), the logic behaves predictably.

Regarding other comments: I have checked the PR and there are no other review comments in the provided context. If you have additional concerns or comments you would like me to review, please provide them.

superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx

// Track if descriptionDetails was explicitly provided
  const hasExplicitDetails = !!descriptionDetails;

  const message = hasExplicitDetails ? undefined : subtitle;

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

Restores parity between Explore and Dashboard chart error rendering by ensuring dashboard chart errors can expand (“See more”) to reveal details/stack traces again, and by guaranteeing an expand affordance even when no stack trace/link is available.

Changes:

  • Forward chartStackTrace from the dashboard chart wrapper into ChartContainer so dashboard failures can render expandable details.
  • Adjust ErrorMessageWithStackTrace so a subtitle-only error uses the collapsible details section (enabling “See more”) rather than rendering as a flat, truncated message.
  • Add regression tests covering both behaviors.

Reviewed changes

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

File Description
superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx Forwards chartStackTrace into ChartContainer for dashboard charts.
superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx Adds regression test asserting chartStackTrace is passed through.
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx Ensures subtitle-only errors still get collapsible details (“See more”).
superset-frontend/src/components/Chart/ChartErrorMessage.test.tsx Adds regression test asserting “See more” exists even without a stack trace.

Comment thread superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx Outdated
Drop the shared ErrorMessageWithStackTrace change after review feedback; the
dashboard chart error regression is fully addressed by forwarding
chartStackTrace into ChartContainer, matching Explore's behavior.
@pull-request-size pull-request-size Bot added size/S and removed size/M labels Jul 28, 2026
@yousoph

yousoph commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

Thanks for the review. I've scoped this PR down to the core regression fix: the one-line chartStackTrace forward in the dashboard Chart wrapper, which restores stack-trace / "See more" parity with Explore for failed dashboard charts.

I reverted the shared ErrorMessageWithStackTrace change that was flagged — the identity-based message check had the edge case noted (same value passed as both subtitle and descriptionDetails), and moving the subtitle behind "See more" app-wide was broader than this regression needs. Keeping the fix minimal and targeted.

@sadpandajoe
sadpandajoe requested a review from kgabryje July 28, 2026 01:08
@sadpandajoe

Copy link
Copy Markdown
Member

@yousoph can you add before and after images to this PR?

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.52%. Comparing base (f8c05bb) to head (c769c68).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42491      +/-   ##
==========================================
+ Coverage   64.50%   64.52%   +0.02%     
==========================================
  Files        2803     2803              
  Lines      158383   158455      +72     
  Branches    36152    36169      +17     
==========================================
+ Hits       102164   102243      +79     
+ Misses      54216    54209       -7     
  Partials     2003     2003              
Flag Coverage Δ
javascript 71.47% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sadpandajoe
sadpandajoe merged commit ff9bec2 into apache:master Aug 1, 2026
70 checks passed
@sadpandajoe
sadpandajoe deleted the dashboard-chart-error-expandable branch August 1, 2026 22:26
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 dashboard:error Related to Dashboard errors size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants