Skip to content

fix(dashboard): show an access error for charts the viewer cannot read - #45398

Merged
madhushreeag merged 2 commits into
masterfrom
madhu/fix-dashboard-hydrate-inaccessible-chart
Oct 16, 2026
Merged

madhushreeag merged 2 commits into
masterfrom
madhu/fix-dashboard-hydrate-inaccessible-chart

Conversation

@madhushreeag

Copy link
Copy Markdown
Contributor

SUMMARY

A published dashboard with charts on partly inaccessible datasets goes blank with TypeError ... reading 'slice_id'. The API withholds form_data for restricted charts (#42716), and the frontend didn't handle that in two places.

  1. Hydration crashed. hydrateDashboard read chartItem.form_data.slice_id unconditionally, so one restricted chart took the whole dashboard down.
  2. Restricted charts spun forever. With only the crash fixed, those charts stayed on a loading spinner. Their form_data has no datasource, so exploreJSON threw while building the query (DatasourceKey(undefined)), after the chart was already marked loading and before any request was sent. Nothing ever moved it out of that state, and a later refresh would put it back.

Changes

  • hydrate.ts: derive slice_id from the id the API still sends when form_data is absent, and keep such a chart on the dashboard with a minimal { slice_id, url_params } form_data (skipping applyDefaultFormData, which needs a viz_type). HydrateChartData.form_data becomes optional to match what the API returns; the version-history code already read it as chart.form_data?.slice_id.
  • chartAction.ts: in exploreJSON, a saved chart (it has a slice_id) with no datasource is failed with a CHART_SECURITY_ACCESS_ERROR ("You don't have access to this chart.") instead of throwing. It sends no request. The guard is on saved charts only, so callers passing an ad-hoc form data are unaffected. Because it lives in exploreJSON, a later refresh can't bring the spinner back.

This is separate from #44215, which restores form_data for promiscuous-viewer mode. A viewer with genuinely no access to a dataset still receives charts without form_data, and that case hit both problems above.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: Crash or spinning charts that are inaccessible
After:
Screenshot 2026-10-16 at 2 23 19 PM

TESTING INSTRUCTIONS

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

@madhushreeag
madhushreeag marked this pull request as ready for review October 16, 2026 21:47
@madhushreeag
madhushreeag requested a review from villebro October 16, 2026 21:47

@villebro villebro left a comment

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.

Nice!

@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; inaccessible charts remain on the dashboard and show an access error instead of blocking hydration.
  • The existing query is aborted before the error is dispatched, and tests cover both the access-error path and the in-flight request race.

Assessed commit: 1b444ac0cfe7

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.49%. Comparing base (853f207) to head (1b444ac).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #45398   +/-   ##
=======================================
  Coverage   83.49%   83.49%           
=======================================
  Files        3047     3047           
  Lines      199537   199548   +11     
  Branches    46559    46566    +7     
=======================================
+ Hits       166608   166620   +12     
+ Misses      29700    29699    -1     
  Partials     3229     3229           
Flag Coverage Δ
javascript 79.23% <100.00%> (+<0.01%) ⬆️

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.

@madhushreeag
madhushreeag merged commit a9a7a35 into master Oct 16, 2026
80 checks passed
@madhushreeag
madhushreeag deleted the madhu/fix-dashboard-hydrate-inaccessible-chart branch October 16, 2026 22:56
villebro pushed a commit that referenced this pull request Oct 16, 2026
villebro added a commit that referenced this pull request Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants